You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2015/08/25 09:26:14 UTC
[3/3] ignite git commit: IGNITE-843 WIP on preview.
IGNITE-843 WIP on preview.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0b72d82a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0b72d82a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0b72d82a
Branch: refs/heads/ignite-843
Commit: 0b72d82a6d63fd42fdd621137ebee82404fb2a96
Parents: f8a5ca3
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Tue Aug 25 14:26:30 2015 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Tue Aug 25 14:26:30 2015 +0700
----------------------------------------------------------------------
modules/control-center-web/src/main/js/app.js | 1 +
.../main/js/controllers/caches-controller.js | 9 +
.../main/js/controllers/clusters-controller.js | 41 +-
.../src/main/js/controllers/common-module.js | 633 +------------
.../main/js/controllers/metadata-controller.js | 7 +
.../src/main/js/controllers/models/caches.json | 5 +
.../main/js/controllers/models/clusters.json | 11 +
.../main/js/controllers/summary-controller.js | 3 +-
.../src/main/js/helpers/common-utils.js | 43 +
.../src/main/js/helpers/data-structures.js | 60 +-
.../src/main/js/routes/agent.js | 10 +-
.../src/main/js/routes/clusters.js | 10 +-
.../src/main/js/routes/generator/common.js | 305 -------
.../src/main/js/routes/generator/docker.js | 58 --
.../js/routes/generator/generator-common.js | 254 ++++++
.../js/routes/generator/generator-docker.js | 57 ++
.../main/js/routes/generator/generator-java.js | 886 ++++++++++++++++++
.../js/routes/generator/generator-properties.js | 269 ++++++
.../main/js/routes/generator/generator-xml.js | 896 +++++++++++++++++++
.../src/main/js/routes/generator/java.js | 873 ------------------
.../src/main/js/routes/generator/xml.js | 767 ----------------
.../src/main/js/routes/notebooks.js | 2 +-
.../src/main/js/routes/public.js | 2 +-
.../src/main/js/routes/summary.js | 32 +-
.../src/main/js/routes/utils.js | 37 -
.../main/js/views/configuration/sidebar.jade | 6 +
.../src/main/js/views/includes/controls.jade | 8 +-
27 files changed, 2583 insertions(+), 2702 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0b72d82a/modules/control-center-web/src/main/js/app.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app.js b/modules/control-center-web/src/main/js/app.js
index 81107ec..2fc69b3 100644
--- a/modules/control-center-web/src/main/js/app.js
+++ b/modules/control-center-web/src/main/js/app.js
@@ -69,6 +69,7 @@ app.use(require('node-sass-middleware')({
app.use(express.static(path.join(__dirname, 'public')));
app.use(express.static(path.join(__dirname, 'controllers')));
app.use(express.static(path.join(__dirname, 'helpers')));
+app.use(express.static(path.join(__dirname, 'routes/generator')));
app.use(cookieParser('keyboard cat'));
http://git-wip-us.apache.org/repos/asf/ignite/blob/0b72d82a/modules/control-center-web/src/main/js/controllers/caches-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/caches-controller.js b/modules/control-center-web/src/main/js/controllers/caches-controller.js
index f7e67d6..1b17f7f 100644
--- a/modules/control-center-web/src/main/js/controllers/caches-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/caches-controller.js
@@ -89,6 +89,11 @@ controlCenterModule.controller('cachesController', [
$scope.panels = {activePanels: [0]};
+ $scope.$watchCollection('panels.activePanels', function () {
+ $timeout(function() {
+ $common.previewHeightUpdate();
+ })
+ });
$scope.general = [];
$scope.advanced = [];
@@ -288,7 +293,11 @@ controlCenterModule.controller('cachesController', [
function validate(item) {
if ($common.isEmptyString(item.name))
return showPopoverMessage($scope.panels, 'general-data', 'cacheName', 'Name should not be empty');
+ sessionStorage.removeItem('cacheSelectedItem');
+ $timeout(function () {
+ $common.previewHeightUpdate();
+ })
if (item.memoryMode == 'OFFHEAP_TIERED' && item.offHeapMaxMemory == null)
return showPopoverMessage($scope.panels, 'memory-data', 'offHeapMaxMemory',
'Off-heap max memory should be specified');
http://git-wip-us.apache.org/repos/asf/ignite/blob/0b72d82a/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 2c7d016..36406c8 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
@@ -15,8 +15,8 @@
* limitations under the License.
*/
-controlCenterModule.controller('clustersController', ['$scope', '$http', '$common', '$focus', '$confirm', '$copy', '$table', '$preview', '$code',
- function ($scope, $http, $common, $focus, $confirm, $copy, $table, $preview, $code) {
+controlCenterModule.controller('clustersController', ['$scope', '$http', '$timeout', '$common', '$focus', '$confirm', '$copy', '$table', '$preview',
+ function ($scope, $http, $timeout, $common, $focus, $confirm, $copy, $table, $preview) {
$scope.joinTip = $common.joinTip;
$scope.getModel = $common.getModel;
@@ -62,8 +62,8 @@ controlCenterModule.controller('clustersController', ['$scope', '$http', '$commo
$scope.events = [];
- for (var eventGroupName in eventGroups) {
- if (eventGroups.hasOwnProperty(eventGroupName)) {
+ for (var eventGroupName in $dataStructures.EVENT_GROUPS) {
+ if ($dataStructures.EVENT_GROUPS.hasOwnProperty(eventGroupName)) {
$scope.events.push({value: eventGroupName, label: eventGroupName});
}
}
@@ -92,6 +92,11 @@ controlCenterModule.controller('clustersController', ['$scope', '$http', '$commo
$scope.panels = {activePanels: [0]};
+ $scope.$watchCollection('panels.activePanels', function () {
+ $timeout(function() {
+ $common.previewHeightUpdate();
+ })
+ });
var simpleTables = {
addresses: {msg: 'Such IP address already exists!', id: 'IpAddress'},
regions: {msg: 'Such region already exists!', id: 'Region'},
@@ -185,18 +190,18 @@ controlCenterModule.controller('clustersController', ['$scope', '$http', '$commo
if (val) {
sessionStorage.clusterBackupItem = angular.toJson(val);
- $scope.preview.general = $code.xmlClusterGeneral(val).join('');
- $scope.preview.atomics = $code.xmlClusterAtomics(val).join('');
- $scope.preview.communication = $code.xmlClusterCommunication(val).join('');
- $scope.preview.deployment = $code.xmlClusterDeployment(val).join('');
- $scope.preview.events = $code.xmlClusterEvents(val).join('');
- $scope.preview.marshaller = $code.xmlClusterMarshaller(val).join('');
- $scope.preview.metrics = $code.xmlClusterMetrics(val).join('');
- $scope.preview.p2p = $code.xmlClusterP2P(val).join('');
- $scope.preview.swap = $code.xmlClusterSwap(val).join('');
- $scope.preview.time = $code.xmlClusterTime(val).join('');
- $scope.preview.pools = $code.xmlClusterPools(val).join('');
- $scope.preview.transactions = $code.xmlClusterTransactions(val).join('');
+ $scope.preview.general = $generatorXml.general(val).join('');
+ $scope.preview.atomics = $generatorXml.atomics(val).join('');
+ $scope.preview.communication = $generatorXml.communication(val).join('');
+ $scope.preview.deployment = $generatorXml.deployment(val).join('');
+ $scope.preview.events = $generatorXml.events(val).join('');
+ $scope.preview.marshaller = $generatorXml.marshaller(val).join('');
+ $scope.preview.metrics = $generatorXml.metrics(val).join('');
+ $scope.preview.p2p = $generatorXml.p2p(val).join('');
+ $scope.preview.swap = $generatorXml.swap(val).join('');
+ $scope.preview.time = $generatorXml.time(val).join('');
+ $scope.preview.pools = $generatorXml.pools(val).join('');
+ $scope.preview.transactions = $generatorXml.transactions(val).join('');
}
}, true);
})
@@ -245,7 +250,11 @@ controlCenterModule.controller('clustersController', ['$scope', '$http', '$commo
function validate(item) {
if ($common.isEmptyString(item.name))
return showPopoverMessage($scope.panels, 'general-data', 'clusterName', 'Name should not be empty');
+ sessionStorage.removeItem('clusterSelectedItem');
+ $timeout(function () {
+ $common.previewHeightUpdate();
+ })
if (item.discovery.kind == 'Vm' && item.discovery.Vm.addresses.length == 0)
return showPopoverMessage($scope.panels, 'general-data', 'addresses', 'Addresses are not specified');
http://git-wip-us.apache.org/repos/asf/ignite/blob/0b72d82a/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 5de7a8a..0e99437 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
@@ -479,6 +479,24 @@ controlCenterModule.service('$common', [
return false;
}
+ function resizePreview (el) {
+ var left = $('#' + el.id + '-left');
+
+ if (left.height() > 0) {
+ var right = $('#' + el.id + '-right');
+
+ var scrollHeight = right.find('.ace_scrollbar-h').height()
+
+ var parent = right.parent()
+
+ parent.outerHeight(left.height() - 2 * parent.css('marginTop').replace("px", ""));
+
+ right.height(left.height() - scrollHeight - 2 * parent.css('marginTop').replace("px", ""));
+
+ right.resize();
+ }
+ }
+
return {
getModel: function (obj, field) {
var path = field.path;
@@ -536,7 +554,7 @@ controlCenterModule.service('$common', [
return false;
},
- isEmptyArray: isEmptyArray,
+ isEmptyArray: isEmptyArray,
isEmptyString: isEmptyString,
errorMessage: errorMessage,
showError: showError,
@@ -627,6 +645,11 @@ controlCenterModule.service('$common', [
hidePopover: function () {
if (popover)
popover.hide();
+ },
+ previewHeightUpdate: function () {
+ $('.panel-collapse').each(function (ix, el) {
+ resizePreview(el);
+ })
}
}
}]);
@@ -918,7 +941,7 @@ controlCenterModule.service('$preview', [function () {
return {
previewInit: function (editor) {
editor.setReadOnly(true);
- editor.setOption("highlightActiveLine", false);
+ editor.setOption('highlightActiveLine', false);
editor.$blockScrolling = Infinity;
var renderer = editor.renderer;
@@ -933,612 +956,6 @@ controlCenterModule.service('$preview', [function () {
}
}]);
-// Preview support service.
-controlCenterModule.service('$code', ['$common', function ($common) {
- function builder() {
- var res = [];
-
- res.deep = 0;
- res.lineStart = true;
-
- res.append = function (s) {
- if (this.lineStart) {
- for (var i = 0; i < this.deep; i++)
- this.push(' ');
-
- this.lineStart = false;
- }
-
- this.push(s);
-
- return this;
- };
-
- res.line = function (s) {
- if (s)
- this.append(s);
-
- this.push('\n');
- this.lineStart = true;
-
- return this;
- };
-
- res.startBlock = function (s) {
- if (s)
- this.append(s);
-
- this.push('\n');
- this.lineStart = true;
- this.deep++;
-
- return this;
- };
-
- res.endBlock = function (s) {
- this.deep--;
-
- if (s)
- this.append(s);
-
- this.push('\n');
- this.lineStart = true;
-
- return this;
- };
-
- res.emptyLineIfNeeded = function () {
- if (this.needEmptyLine) {
- this.line();
-
- this.needEmptyLine = false;
-
- return true;
- }
-
- return false;
- };
-
- res.imports = {};
-
- res.importClass = function (className) {
- var fullClassName = javaBuildInClass(className);
-
- var dotIdx = fullClassName.lastIndexOf('.');
-
- var 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;
- };
-
- /**
- * @returns String with "java imports" section.
- */
- res.generateImports = function () {
- var res = [];
-
- for (var clsName in this.imports) {
- if (this.imports.hasOwnProperty(clsName) && this.imports[clsName].lastIndexOf('java.lang.', 0) != 0)
- res.push('import ' + this.imports[clsName] + ';');
- }
-
- res.sort();
-
- return res.join('\n')
- };
-
- return res;
- }
-
- function escapeAttr(s) {
- if (typeof(s) != 'string')
- return s;
-
- return s.replace(/&/g, '&').replace(/"/g, '"');
- }
-
- function addElement(res, tag, attr1, val1, attr2, val2) {
- var elem = '<' + tag;
-
- if (attr1) {
- elem += ' ' + attr1 + '="' + val1 + '"'
- }
-
- if (attr2) {
- elem += ' ' + attr2 + '="' + val2 + '"'
- }
-
- elem += '/>';
-
- res.emptyLineIfNeeded();
- res.line(elem);
- }
-
- function addProperty(res, obj, propName, setterName) {
- var val = obj[propName];
-
- if ($common.isDefined(val))
- addElement(res, 'property', 'name', setterName ? setterName : propName, 'value', escapeAttr(val));
-
- return val;
- }
-
- function addClassNameProperty(res, obj, propName) {
- var val = obj[propName];
-
- if ($common.isDefined(val))
- addElement(res, 'property', 'name', propName, 'value', $common.javaBuildInClass(val));
-
- return val;
- }
-
- function addListProperty(res, obj, propName, listType, rowFactory) {
- var val = obj[propName];
-
- if (val && val.length > 0) {
- res.emptyLineIfNeeded();
-
- if (!listType)
- listType = 'list';
-
- if (!rowFactory)
- rowFactory = function (val) {
- return '<value>' + escape(val) + '</value>'
- };
-
- res.startBlock('<property name="' + propName + '">');
- res.startBlock('<' + listType + '>');
-
- for (var i = 0; i < val.length; i++)
- res.line(rowFactory(val[i]));
-
- res.endBlock('</' + listType + '>');
- res.endBlock('</property>');
- }
- }
-
- function ClassDescriptor(className, fields) {
- this.className = className;
- this.fields = fields;
- }
-
- var eventGroups = {
- EVTS_CHECKPOINT: ['EVT_CHECKPOINT_SAVED', 'EVT_CHECKPOINT_LOADED', 'EVT_CHECKPOINT_REMOVED'],
- EVTS_DEPLOYMENT: ['EVT_CLASS_DEPLOYED', 'EVT_CLASS_UNDEPLOYED', 'EVT_CLASS_DEPLOY_FAILED', 'EVT_TASK_DEPLOYED',
- 'EVT_TASK_UNDEPLOYED', 'EVT_TASK_DEPLOY_FAILED'],
- EVTS_ERROR: ['EVT_JOB_TIMEDOUT', 'EVT_JOB_FAILED', 'EVT_JOB_FAILED_OVER', 'EVT_JOB_REJECTED', 'EVT_JOB_CANCELLED',
- 'EVT_TASK_TIMEDOUT', 'EVT_TASK_FAILED', 'EVT_CLASS_DEPLOY_FAILED', 'EVT_TASK_DEPLOY_FAILED',
- 'EVT_TASK_DEPLOYED', 'EVT_TASK_UNDEPLOYED', 'EVT_CACHE_REBALANCE_STARTED', 'EVT_CACHE_REBALANCE_STOPPED'],
- EVTS_DISCOVERY: ['EVT_NODE_JOINED', 'EVT_NODE_LEFT', 'EVT_NODE_FAILED', 'EVT_NODE_SEGMENTED',
- 'EVT_CLIENT_NODE_DISCONNECTED', 'EVT_CLIENT_NODE_RECONNECTED'],
- EVTS_JOB_EXECUTION: ['EVT_JOB_MAPPED', 'EVT_JOB_RESULTED', 'EVT_JOB_FAILED_OVER', 'EVT_JOB_STARTED',
- 'EVT_JOB_FINISHED', 'EVT_JOB_TIMEDOUT', 'EVT_JOB_REJECTED', 'EVT_JOB_FAILED', 'EVT_JOB_QUEUED',
- 'EVT_JOB_CANCELLED'],
- EVTS_TASK_EXECUTION: ['EVT_TASK_STARTED', 'EVT_TASK_FINISHED', 'EVT_TASK_FAILED', 'EVT_TASK_TIMEDOUT',
- 'EVT_TASK_SESSION_ATTR_SET', 'EVT_TASK_REDUCED'],
- EVTS_CACHE: ['EVT_CACHE_ENTRY_CREATED', 'EVT_CACHE_ENTRY_DESTROYED', 'EVT_CACHE_OBJECT_PUT',
- 'EVT_CACHE_OBJECT_READ', 'EVT_CACHE_OBJECT_REMOVED', 'EVT_CACHE_OBJECT_LOCKED', 'EVT_CACHE_OBJECT_UNLOCKED',
- 'EVT_CACHE_OBJECT_SWAPPED', 'EVT_CACHE_OBJECT_UNSWAPPED', 'EVT_CACHE_OBJECT_EXPIRED'],
- EVTS_CACHE_REBALANCE: ['EVT_CACHE_REBALANCE_STARTED', 'EVT_CACHE_REBALANCE_STOPPED',
- 'EVT_CACHE_REBALANCE_PART_LOADED', 'EVT_CACHE_REBALANCE_PART_UNLOADED', 'EVT_CACHE_REBALANCE_OBJECT_LOADED',
- 'EVT_CACHE_REBALANCE_OBJECT_UNLOADED', 'EVT_CACHE_REBALANCE_PART_DATA_LOST'],
- EVTS_CACHE_LIFECYCLE: ['EVT_CACHE_STARTED', 'EVT_CACHE_STOPPED', 'EVT_CACHE_NODES_LEFT'],
- EVTS_CACHE_QUERY: ['EVT_CACHE_QUERY_EXECUTED', 'EVT_CACHE_QUERY_OBJECT_READ'],
- EVTS_SWAPSPACE: ['EVT_SWAP_SPACE_CLEARED', 'EVT_SWAP_SPACE_DATA_REMOVED', 'EVT_SWAP_SPACE_DATA_READ',
- 'EVT_SWAP_SPACE_DATA_STORED', 'EVT_SWAP_SPACE_DATA_EVICTED'],
- EVTS_IGFS: ['EVT_IGFS_FILE_CREATED', 'EVT_IGFS_FILE_RENAMED', 'EVT_IGFS_FILE_DELETED', 'EVT_IGFS_FILE_OPENED_READ',
- 'EVT_IGFS_FILE_OPENED_WRITE', 'EVT_IGFS_FILE_CLOSED_WRITE', 'EVT_IGFS_FILE_CLOSED_READ', 'EVT_IGFS_FILE_PURGED',
- 'EVT_IGFS_META_UPDATED', 'EVT_IGFS_DIR_CREATED', 'EVT_IGFS_DIR_RENAMED', 'EVT_IGFS_DIR_DELETED']
- };
-
- var atomicConfiguration = new ClassDescriptor('org.apache.ignite.configuration.AtomicConfiguration', {
- backups: null,
- cacheMode: {type: 'enum', enumClass: 'CacheMode'},
- atomicSequenceReserveSize: null
- });
-
- var evictionPolicies = {
- 'LRU': new ClassDescriptor('org.apache.ignite.cache.eviction.lru.LruEvictionPolicy',
- {batchSize: null, maxMemorySize: null, maxSize: null}),
- 'RND': new ClassDescriptor('org.apache.ignite.cache.eviction.random.RandomEvictionPolicy', {maxSize: null}),
- 'FIFO': new ClassDescriptor('org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy',
- {batchSize: null, maxMemorySize: null, maxSize: null}),
- 'SORTED': new ClassDescriptor('org.apache.ignite.cache.eviction.sorted.SortedEvictionPolicy',
- {batchSize: null, maxMemorySize: null, maxSize: null})
- };
-
- var marshallers = {
- OptimizedMarshaller: new ClassDescriptor('org.apache.ignite.marshaller.optimized.OptimizedMarshaller', {
- poolSize: null,
- requireSerializable: null
- }),
- JdkMarshaller: new ClassDescriptor('org.apache.ignite.marshaller.jdk.JdkMarshaller', {})
- };
-
- var swapSpaceSpi = new ClassDescriptor('org.apache.ignite.spi.swapspace.file.FileSwapSpaceSpi', {
- baseDirectory: null,
- readStripesNumber: null,
- maximumSparsity: {type: 'float'},
- maxWriteQueueSize: null,
- writeBufferSize: null
- });
-
- var transactionConfiguration = new ClassDescriptor('org.apache.ignite.configuration.TransactionConfiguration', {
- defaultTxConcurrency: {type: 'enum', enumClass: 'TransactionConcurrency'},
- transactionIsolation: {type: 'TransactionIsolation', setterName: 'defaultTxIsolation'},
- defaultTxTimeout: null,
- pessimisticTxLogLinger: null,
- pessimisticTxLogSize: null,
- txSerializableEnabled: null
- });
-
- var knownClasses = {
- Oracle: new ClassDescriptor('org.apache.ignite.cache.store.jdbc.dialect.OracleDialect', {}),
- DB2: new ClassDescriptor('org.apache.ignite.cache.store.jdbc.dialect.DB2Dialect', {}),
- SQLServer: new ClassDescriptor('org.apache.ignite.cache.store.jdbc.dialect.SQLServerDialect', {}),
- MySQL: new ClassDescriptor('org.apache.ignite.cache.store.jdbc.dialect.MySQLDialect', {}),
- PostgreSQL: new ClassDescriptor('org.apache.ignite.cache.store.jdbc.dialect.BasicJdbcDialect', {}),
- H2: new ClassDescriptor('org.apache.ignite.cache.store.jdbc.dialect.H2Dialect', {})
- };
-
- function addBeanWithProperties(res, bean, beanPropName, beanClass, props, createBeanAlthoughNoProps) {
- if (bean && $common.hasProperty(bean, props)) {
- res.emptyLineIfNeeded();
- res.startBlock('<property name="' + beanPropName + '">');
- res.startBlock('<bean class="' + beanClass + '">');
-
- for (var propName in props) {
- if (props.hasOwnProperty(propName)) {
- var descr = props[propName];
-
- if (descr) {
- if (descr.type == 'list') {
- addListProperty(res, bean, propName, descr.setterName);
- }
- else if (descr.type == 'className') {
- if (bean[propName]) {
- res.startBlock('<property name="' + propName + '">');
- res.line('<bean class="' + knownClasses[bean[propName]].className + '"/>');
- res.endBlock('</property>');
- }
- }
- else if (descr.type == 'propertiesAsList') {
- var val = bean[propName];
-
- if (val && val.length > 0) {
- res.startBlock('<property name="' + propName + '">');
- res.startBlock('<props>');
-
- for (var i = 0; i < val.length; i++) {
- var nameAndValue = val[i];
-
- var eqIndex = nameAndValue.indexOf('=');
- if (eqIndex >= 0) {
- res.line('<prop key="' + escapeAttr(nameAndValue.substring(0, eqIndex)) + '">' +
- escape(nameAndValue.substr(eqIndex + 1)) + '</prop>');
- }
- }
-
- res.endBlock('</props>');
- res.endBlock('</property>');
- }
- }
- else
- addProperty(res, bean, propName, descr.setterName);
- }
- else
- addProperty(res, bean, propName);
- }
- }
-
- res.endBlock('</bean>');
- res.endBlock('</property>');
- }
- else if (createBeanAlthoughNoProps) {
- res.emptyLineIfNeeded();
- res.line('<property name="' + beanPropName + '">');
- res.line(' <bean class="' + beanClass + '"/>');
- res.line('</property>');
- }
- }
-
- return {
- xmlClusterGeneral: function (cluster, res) {
- if (!res)
- res = builder();
-
- // Generate discovery.
- if (cluster.discovery) {
- res.startBlock('<property name="discoverySpi">');
- res.startBlock('<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">');
- res.startBlock('<property name="ipFinder">');
-
- var d = cluster.discovery;
-
- switch (d.kind) {
- case 'Multicast':
- res.startBlock('<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">');
-
- addProperty(res, d.Multicast, 'multicastGroup');
- addProperty(res, d.Multicast, 'multicastPort');
- addProperty(res, d.Multicast, 'responseWaitTime');
- addProperty(res, d.Multicast, 'addressRequestAttempts');
- addProperty(res, d.Multicast, 'localAddress');
-
- res.endBlock('</bean>');
-
- break;
-
- case 'Vm':
- if (d.Vm.addresses.length > 0) {
- res.startBlock('<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">');
-
- addListProperty(res, d.Vm, 'addresses');
-
- res.endBlock('</bean>');
- }
- else {
- res.line('<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder"/>');
- }
-
- break;
-
- case 'S3':
- res.startBlock('<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.s3.TcpDiscoveryS3IpFinder">');
-
- if (d.S3 && d.S3.bucketName)
- res.line('<property name="bucketName" value="' + escapeAttr(d.S3.bucketName) + '" />');
-
- res.endBlock('</bean>');
-
- break;
-
- case 'Cloud':
- res.startBlock('<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.cloud.TcpDiscoveryCloudIpFinder">');
-
- addProperty(res, d.Cloud, 'credential');
- addProperty(res, d.Cloud, 'credentialPath');
- addProperty(res, d.Cloud, 'identity');
- addProperty(res, d.Cloud, 'provider');
- addListProperty(res, d.Cloud, 'regions');
- addListProperty(res, d.Cloud, 'zones');
-
- res.endBlock('</bean>');
-
- break;
-
- case 'GoogleStorage':
- res.startBlock('<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.gce.TcpDiscoveryGoogleStorageIpFinder">');
-
- addProperty(res, d.GoogleStorage, 'projectName');
- addProperty(res, d.GoogleStorage, 'bucketName');
- addProperty(res, d.GoogleStorage, 'serviceAccountP12FilePath');
- addProperty(res, d.GoogleStorage, 'serviceAccountId');
-
- //if (d.GoogleStorage.addrReqAttempts) todo ????
- // res.line('<property name="serviceAccountP12FilePath" value="' + escapeAttr(d.GoogleStorage.addrReqAttempts) + '"/>');
-
- res.endBlock('</bean>');
-
- break;
-
- case 'Jdbc':
- res.startBlock('<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.jdbc.TcpDiscoveryJdbcIpFinder">');
- res.line('<property name="initSchema" value="' + ($common.isDefined(d.Jdbc.initSchema) && d.Jdbc.initSchema) + '"/>');
- res.endBlock('</bean>');
-
- break;
-
- case 'SharedFs':
- if (d.SharedFs.path) {
- res.startBlock('<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.sharedfs.TcpDiscoverySharedFsIpFinder">');
- addProperty(res, d.SharedFs, 'path');
- res.endBlock('</bean>');
- }
- else {
- res.line('<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.sharedfs.TcpDiscoverySharedFsIpFinder"/>');
- }
-
- break;
-
- default:
- throw "Unknown discovery kind: " + d.kind;
- }
-
- res.endBlock('</property>');
- res.endBlock('</bean>');
- res.endBlock('</property>');
-
- res.needEmptyLine = true;
- }
-
- return res;
- },
- xmlClusterAtomics: function (cluster, res) {
- if (!res)
- res = builder();
-
- // Generate atomics group.
- addBeanWithProperties(res, cluster.atomicConfiguration, 'atomicConfiguration',
- atomicConfiguration.className, atomicConfiguration.fields);
- res.needEmptyLine = true;
-
- return res;
- },
- xmlClusterCommunication: function (cluster, res) {
- if (!res)
- res = builder();
-
- // Generate communication group.
- addProperty(res, cluster, 'networkTimeout');
- addProperty(res, cluster, 'networkSendRetryDelay');
- addProperty(res, cluster, 'networkSendRetryCount');
- addProperty(res, cluster, 'segmentCheckFrequency');
- addProperty(res, cluster, 'waitForSegmentOnStart');
- addProperty(res, cluster, 'discoveryStartupDelay');
- res.needEmptyLine = true;
-
- return res;
- },
- xmlClusterDeployment: function(cluster, res) {
- if (!res)
- res = builder();
-
- // Generate deployment group.
- addProperty(res, cluster, 'deploymentMode');
- res.needEmptyLine = true;
-
- return res;
- },
- xmlClusterEvents: function(cluster, res) {
- if (!res)
- res = builder();
-
- // Generate events group.
- if (cluster.includeEventTypes && cluster.includeEventTypes.length > 0) {
- res.emptyLineIfNeeded();
-
- res.startBlock('<property name="includeEventTypes">');
-
- if (cluster.includeEventTypes.length == 1)
- res.line('<util:constant static-field="org.apache.ignite.events.EventType.' + cluster.includeEventTypes[0] + '"/>');
- else {
- res.startBlock('<array>');
-
- for (i = 0; i < cluster.includeEventTypes.length; i++) {
- if (i > 0)
- res.line();
-
- var eventGroup = cluster.includeEventTypes[i];
-
- res.line('<!-- EventType.' + eventGroup + ' -->');
-
- var eventList = eventGroups[eventGroup];
-
- for (var k = 0; k < eventList.length; k++) {
- res.line('<util:constant static-field="org.apache.ignite.events.EventType.' + eventList[k] + '"/>')
- }
- }
-
- res.endBlock('</array>');
- }
-
- res.endBlock('</property>');
-
- res.needEmptyLine = true;
- }
-
- return res;
- },
- xmlClusterMarshaller: function(cluster, res) {
- if (!res)
- res = builder();
-
- // Generate marshaller group.
- var marshaller = cluster.marshaller;
-
- if (marshaller && marshaller.kind) {
- var marshallerDesc = marshallers[marshaller.kind];
-
- addBeanWithProperties(res, marshaller[marshaller.kind], 'marshaller', marshallerDesc.className, marshallerDesc.fields, true);
- res.needEmptyLine = true;
- }
-
- addProperty(res, cluster, 'marshalLocalJobs');
- addProperty(res, cluster, 'marshallerCacheKeepAliveTime');
- addProperty(res, cluster, 'marshallerCacheThreadPoolSize');
- res.needEmptyLine = true;
-
- return res;
- },
- xmlClusterMetrics: function(cluster, res) {
- if (!res)
- res = builder();
-
- // Generate metrics group.
- addProperty(res, cluster, 'metricsExpireTime');
- addProperty(res, cluster, 'metricsHistorySize');
- addProperty(res, cluster, 'metricsLogFrequency');
- addProperty(res, cluster, 'metricsUpdateFrequency');
- res.needEmptyLine = true;
-
- return res;
- },
- xmlClusterP2P: function(cluster, res) {
- if (!res)
- res = builder();
-
- // Generate PeerClassLoading group.
- addProperty(res, cluster, 'peerClassLoadingEnabled');
- addListProperty(res, cluster, 'peerClassLoadingLocalClassPathExclude');
- addProperty(res, cluster, 'peerClassLoadingMissedResourcesCacheSize');
- addProperty(res, cluster, 'peerClassLoadingThreadPoolSize');
- res.needEmptyLine = true;
-
- return res;
- },
- xmlClusterSwap: function(cluster, res) {
- if (!res)
- res = builder();
-
- // Generate swap group.
- if (cluster.swapSpaceSpi && cluster.swapSpaceSpi.kind == 'FileSwapSpaceSpi') {
- addBeanWithProperties(res, cluster.swapSpaceSpi.FileSwapSpaceSpi, 'swapSpaceSpi',
- swapSpaceSpi.className, swapSpaceSpi.fields, true);
-
- res.needEmptyLine = true;
- }
-
- return res;
- },
- xmlClusterTime: function(cluster, res) {
- if (!res)
- res = builder();
-
- // Generate time group.
- addProperty(res, cluster, 'clockSyncSamples');
- addProperty(res, cluster, 'clockSyncFrequency');
- addProperty(res, cluster, 'timeServerPortBase');
- addProperty(res, cluster, 'timeServerPortRange');
- res.needEmptyLine = true;
-
- return res;
- },
- xmlClusterPools: function(cluster, res) {
- if (!res)
- res = builder();
-
- // Generate thread pools group.
- addProperty(res, cluster, 'publicThreadPoolSize');
- addProperty(res, cluster, 'systemThreadPoolSize');
- addProperty(res, cluster, 'managementThreadPoolSize');
- addProperty(res, cluster, 'igfsThreadPoolSize');
- res.needEmptyLine = true;
-
- return res;
- },
- xmlClusterTransactions: function(cluster, res) {
- if (!res)
- res = builder();
-
- // Generate transactions group.
- addBeanWithProperties(res, cluster.transactionConfiguration, 'transactionConfiguration',
- transactionConfiguration.className, transactionConfiguration.fields);
- res.needEmptyLine = true;
-
- return res;
- }
- }
-}]);
-
-
// Filter to decode name using map(value, label).
controlCenterModule.filter('displayValue', function () {
return function (v, m, dflt) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/0b72d82a/modules/control-center-web/src/main/js/controllers/metadata-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/metadata-controller.js b/modules/control-center-web/src/main/js/controllers/metadata-controller.js
index e1d2774..0af5635 100644
--- a/modules/control-center-web/src/main/js/controllers/metadata-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/metadata-controller.js
@@ -148,6 +148,11 @@ controlCenterModule.controller('metadataController', [
$scope.panels = {activePanels: [0, 1]};
+ $scope.$watchCollection('panels.activePanels', function () {
+ $timeout(function() {
+ $common.previewHeightUpdate();
+ })
+ });
$scope.metadatas = [];
$scope.isJavaBuildInClass = function () {
@@ -489,8 +494,10 @@ controlCenterModule.controller('metadataController', [
}
else
selectFirstItem();
+ $scope.selectedItem = sel;
$timeout(function () {
+ $common.previewHeightUpdate();
$scope.$apply();
});
http://git-wip-us.apache.org/repos/asf/ignite/blob/0b72d82a/modules/control-center-web/src/main/js/controllers/models/caches.json
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/models/caches.json b/modules/control-center-web/src/main/js/controllers/models/caches.json
index a0b3a0c..71a4e07 100644
--- a/modules/control-center-web/src/main/js/controllers/models/caches.json
+++ b/modules/control-center-web/src/main/js/controllers/models/caches.json
@@ -316,6 +316,7 @@
},
{
"label": "Queries & Indexing",
+ "id": "queriesAndIndexing-data",
"tip": [
"Cache query settings."
],
@@ -671,6 +672,7 @@
"advanced": [
{
"label": "Concurrency control",
+ "id": "concurrency-data",
"tip": [
"Cache concurrent usage settings."
],
@@ -714,6 +716,7 @@
},
{
"label": "Rebalance",
+ "id": "rebalance-data",
"hide": "backupItem.mode == 'LOCAL'",
"tip": [
"Cache rebalance settings."
@@ -794,6 +797,7 @@
},
{
"label": "Server near cache",
+ "id": "serverNearCache-data",
"hide": "backupItem.mode != 'PARTITIONED'",
"tip": [
"Near cache settings.",
@@ -959,6 +963,7 @@
},
{
"label": "Statistics",
+ "id": "statistics-data",
"tip": [
"Cache statistics and management settings."
],
http://git-wip-us.apache.org/repos/asf/ignite/blob/0b72d82a/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 53d961b..747264c 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
@@ -330,6 +330,7 @@
"advanced": [
{
"label": "Atomics configuration",
+ "id": "atomics-data",
"preview": "atomics",
"tip": [
"Configuration for atomic data structures.",
@@ -377,6 +378,7 @@
},
{
"label": "Communication",
+ "id": "communication-data",
"preview": "communication",
"tip": [
"Cluster communication network properties."
@@ -445,6 +447,7 @@
},
{
"label": "Deployment",
+ "id": "deployment-data",
"preview": "deployment",
"tip": [
"Task and resources deployment in cluster."
@@ -471,6 +474,7 @@
},
{
"label": "Events",
+ "id": "events-data",
"preview": "events",
"tip": [
" Grid events are used for notification about what happens within the grid."
@@ -491,6 +495,7 @@
},
{
"label": "Marshaller",
+ "id": "marshaller-data",
"preview": "marshaller",
"tip": [
"Marshaller allows to marshal or unmarshal objects in grid.",
@@ -571,6 +576,7 @@
},
{
"label": "Metrics",
+ "id": "metrics-data",
"preview": "metrics",
"tip": [
"Cluster runtime metrics settings."
@@ -623,6 +629,7 @@
},
{
"label": "Peer Class Loading",
+ "id": "p2p-data",
"preview": "p2p",
"tip": [
"Cluster peer class loading settings."
@@ -669,6 +676,7 @@
},
{
"label": "Swap",
+ "id": "swap-data",
"preview": "swap",
"id": "swap-data",
"tip": [
@@ -752,6 +760,7 @@
},
{
"label": "Time configuration",
+ "id": "time-data",
"preview": "time",
"tip": [
"Time settings for CLOCK write ordering mode."
@@ -801,6 +810,7 @@
},
{
"label": "Thread pools size",
+ "id": "pools-data",
"preview": "pools",
"tip": [
"Settings for node thread pools."
@@ -846,6 +856,7 @@
},
{
"label": "Transactions",
+ "id": "transactions-data",
"preview": "transactions",
"tip": [
"Settings for transactions."
http://git-wip-us.apache.org/repos/asf/ignite/blob/0b72d82a/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 4edc484..60a97e0 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
@@ -50,7 +50,8 @@ controlCenterModule.controller('summaryController', ['$scope', '$http', '$common
$scope.aceInit = function (editor) {
editor.setReadOnly(true);
- editor.setOption("highlightActiveLine", false);
+ editor.setOption('highlightActiveLine', false);
+ editor.$blockScrolling = Infinity;
var renderer = editor.renderer;
http://git-wip-us.apache.org/repos/asf/ignite/blob/0b72d82a/modules/control-center-web/src/main/js/helpers/common-utils.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/helpers/common-utils.js b/modules/control-center-web/src/main/js/helpers/common-utils.js
new file mode 100644
index 0000000..2f74afd
--- /dev/null
+++ b/modules/control-center-web/src/main/js/helpers/common-utils.js
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+$commonUtils = {};
+
+$commonUtils.isDefined = function isDefined(v) {
+ return !(v === undefined || v === null);
+};
+
+$commonUtils.hasProperty = function (obj, props) {
+ for (var propName in props) {
+ if (props.hasOwnProperty(propName)) {
+ if (obj[propName])
+ return true;
+ }
+ }
+
+ return false;
+};
+
+if (typeof window === 'undefined') {
+ $commonUtils.randomValueHex = function randomValueHex(len) {
+ return require('crypto').randomBytes(Math.ceil(len / 2))
+ .toString('hex') // convert to hexadecimal format
+ .slice(0, len); // return required number of characters
+ };
+
+ module.exports = $commonUtils;
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0b72d82a/modules/control-center-web/src/main/js/helpers/data-structures.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/helpers/data-structures.js b/modules/control-center-web/src/main/js/helpers/data-structures.js
index d46fb85..80c64b8 100644
--- a/modules/control-center-web/src/main/js/helpers/data-structures.js
+++ b/modules/control-center-web/src/main/js/helpers/data-structures.js
@@ -15,7 +15,13 @@
* limitations under the License.
*/
-eventGroups = {
+if (typeof window === 'undefined') {
+ $commonUtils = require('./common-utils');
+}
+
+$dataStructures = {};
+
+$dataStructures.EVENT_GROUPS = {
EVTS_CHECKPOINT: ['EVT_CHECKPOINT_SAVED', 'EVT_CHECKPOINT_LOADED', 'EVT_CHECKPOINT_REMOVED'],
EVTS_DEPLOYMENT: ['EVT_CLASS_DEPLOYED', 'EVT_CLASS_UNDEPLOYED', 'EVT_CLASS_DEPLOY_FAILED', 'EVT_TASK_DEPLOYED',
'EVT_TASK_UNDEPLOYED', 'EVT_TASK_DEPLOY_FAILED'],
@@ -44,6 +50,56 @@ eventGroups = {
'EVT_IGFS_META_UPDATED', 'EVT_IGFS_DIR_CREATED', 'EVT_IGFS_DIR_RENAMED', 'EVT_IGFS_DIR_DELETED']
};
+$dataStructures.JAVA_BUILD_IN_CLASSES = [
+ {short: 'BigDecimal', full: 'java.math.BigDecimal'},
+ {short: 'Boolean', full: 'java.lang.Boolean'},
+ {short: 'Byte', full: 'java.lang.Byte'},
+ {short: 'Date', full: 'java.sql.Date'},
+ {short: 'Double', full: 'java.lang.Double'},
+ {short: 'Float', full: 'java.lang.Float'},
+ {short: 'Integer', full: 'java.lang.Integer'},
+ {short: 'Long', full: 'java.lang.Long'},
+ {short: 'Short', full: 'java.lang.Short'},
+ {short: 'String', full: 'java.lang.String'},
+ {short: 'Time', full: 'java.sql.Time'},
+ {short: 'Timestamp', full: 'java.sql.Timestamp'},
+ {short: 'UUID', full: 'java.util.UUID'}
+];
+
+/**
+ * @param clsName Class name to check.
+ * @returns 'true' if given class name is a java build-in type.
+ */
+$dataStructures.isJavaBuildInClass = function (clsName) {
+ if (_isDefined(clsName)) {
+ for (var i = 0; i < $dataStructures.JAVA_BUILD_IN_CLASSES.length; i++) {
+ var jbic = $dataStructures.JAVA_BUILD_IN_CLASSES[i];
+
+ if (clsName == jbic.short || clsName == jbic.full)
+ return true;
+ }
+ }
+
+ return false;
+};
+
+/**
+ * @param clsName Class name to check.
+ * @returns Full class name for java build-in types or source class otherwise.
+ */
+$dataStructures.fullClassName = function (clsName) {
+ if ($commonUtils.isDefined(clsName)) {
+ for (var i = 0; i < $dataStructures.JAVA_BUILD_IN_CLASSES.length; i++) {
+ var jbic = $dataStructures.JAVA_BUILD_IN_CLASSES[i];
+
+ if (clsName == jbic.short)
+ return jbic.full;
+ }
+ }
+
+ return clsName;
+};
+
if (typeof window === 'undefined') {
- exports.eventGroups = eventGroups;
+ module.exports = $dataStructures;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0b72d82a/modules/control-center-web/src/main/js/routes/agent.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/agent.js b/modules/control-center-web/src/main/js/routes/agent.js
index 13b0cbe..c2469c9 100644
--- a/modules/control-center-web/src/main/js/routes/agent.js
+++ b/modules/control-center-web/src/main/js/routes/agent.js
@@ -26,7 +26,7 @@ function _client(req, res) {
var client = agentManager.getAgentManager().findClient(req.currentUserId());
if (!client) {
- res.status(503).send("Client not found");
+ res.status(503).send('Client not found');
return null;
}
@@ -47,7 +47,7 @@ router.post('/topology', function (req, res) {
client.ignite().cluster().then(function (clusters) {
res.json(clusters.map(function (cluster) {
var caches = Object.keys(cluster._caches).map(function (key) {
- return {"name": key, "mode": cluster._caches[key]}
+ return {name: key, mode: cluster._caches[key]}
});
return {nodeId: cluster._nodeId, caches: caches};
@@ -105,11 +105,11 @@ router.post('/query/fetch', function (req, res) {
if (client) {
var cache = client.ignite().cache(req.body.cacheName);
- var cmd = cache._createCommand("qryfetch").addParam("qryId", req.body.queryId).
- addParam("pageSize", req.body.pageSize);
+ var cmd = cache._createCommand('qryfetch').addParam('qryId', req.body.queryId).
+ addParam('pageSize', req.body.pageSize);
cache.__createPromise(cmd).then(function (page) {
- res.json({rows: page["items"], last: page === null || page["last"]});
+ res.json({rows: page['items'], last: page === null || page['last']});
}, function (err) {
res.status(500).send(err);
});
http://git-wip-us.apache.org/repos/asf/ignite/blob/0b72d82a/modules/control-center-web/src/main/js/routes/clusters.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/clusters.js b/modules/control-center-web/src/main/js/routes/clusters.js
index 3c7a41f..0e3b6bf 100644
--- a/modules/control-center-web/src/main/js/routes/clusters.js
+++ b/modules/control-center-web/src/main/js/routes/clusters.js
@@ -41,7 +41,7 @@ router.post('/list', function (req, res) {
});
// Get all caches for spaces.
- db.Cache.find({space: {$in: space_ids}}, '_id name swapEnabled').sort('name').exec(function (err, caches) {
+ db.Cache.find({space: {$in: space_ids}}).sort('name').exec(function (err, caches) {
if (db.processed(err, res)) {
// Get all clusters for spaces.
db.Cluster.find({space: {$in: space_ids}}).sort('name').exec(function (err, clusters) {
@@ -55,13 +55,7 @@ router.post('/list', function (req, res) {
});
});
- res.json({
- spaces: spaces,
- caches: caches.map(function (cache) {
- return {value: cache._id, label: cache.name, swapEnabled: cache.swapEnabled};
- }),
- clusters: clusters
- });
+ res.json({spaces: spaces, caches: caches, clusters: clusters});
}
});
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0b72d82a/modules/control-center-web/src/main/js/routes/generator/common.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/generator/common.js b/modules/control-center-web/src/main/js/routes/generator/common.js
deleted file mode 100644
index a7a2399..0000000
--- a/modules/control-center-web/src/main/js/routes/generator/common.js
+++ /dev/null
@@ -1,305 +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 utils = require('../utils');
-
-exports.mainComment = function mainComment() {
- return 'This configuration was generated by Ignite Control Center ('
- + exports.formatDate(new Date()) + ')';
-};
-
-function _addLeadingZero(numberStr, minSize) {
- if (typeof (numberStr) != 'string')
- numberStr = '' + numberStr;
-
- while (numberStr.length < minSize) {
- numberStr = '0' + numberStr;
- }
-
- return numberStr;
-}
-
-exports.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);
-};
-
-exports.builder = function () {
- var res = [];
-
- res.deep = 0;
- res.lineStart = true;
-
- res.append = function (s) {
- if (this.lineStart) {
- for (var i = 0; i < this.deep; i++)
- this.push(' ');
-
- this.lineStart = false;
- }
-
- this.push(s);
-
- return this;
- };
-
- res.line = function (s) {
- if (s)
- this.append(s);
-
- this.push('\n');
- this.lineStart = true;
-
- return this;
- };
-
- res.startBlock = function (s) {
- if (s)
- this.append(s);
-
- this.push('\n');
- this.lineStart = true;
- this.deep++;
-
- return this;
- };
-
- res.endBlock = function (s) {
- this.deep--;
-
- if (s)
- this.append(s);
-
- this.push('\n');
- this.lineStart = true;
-
- return this;
- };
-
- res.emptyLineIfNeeded = function () {
- if (this.needEmptyLine) {
- this.line();
-
- this.needEmptyLine = false;
-
- return true;
- }
-
- return false;
- };
-
- res.imports = {};
-
- res.importClass = function (className) {
- var fullClassName = javaBuildInClass(className);
-
- var dotIdx = fullClassName.lastIndexOf('.');
-
- var 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;
- };
-
- /**
- * @returns String with "java imports" section.
- */
- res.generateImports = function () {
- var res = [];
-
- for (var clsName in this.imports) {
- if (this.imports.hasOwnProperty(clsName) && this.imports[clsName].lastIndexOf('java.lang.', 0) != 0)
- res.push('import ' + this.imports[clsName] + ';');
- }
-
- res.sort();
-
- return res.join('\n')
- };
-
- return res;
-};
-
-function ClassDescriptor(className, fields) {
- this.className = className;
- this.fields = fields;
-}
-
-exports.evictionPolicies = {
- 'LRU': new ClassDescriptor('org.apache.ignite.cache.eviction.lru.LruEvictionPolicy',
- {batchSize: null, maxMemorySize: null, maxSize: null}),
- 'RND': new ClassDescriptor('org.apache.ignite.cache.eviction.random.RandomEvictionPolicy', {maxSize: null}),
- 'FIFO': new ClassDescriptor('org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy',
- {batchSize: null, maxMemorySize: null, maxSize: null}),
- 'SORTED': new ClassDescriptor('org.apache.ignite.cache.eviction.sorted.SortedEvictionPolicy',
- {batchSize: null, maxMemorySize: null, maxSize: null})
-};
-
-exports.marshallers = {
- OptimizedMarshaller: new ClassDescriptor('org.apache.ignite.marshaller.optimized.OptimizedMarshaller', {
- poolSize: null,
- requireSerializable: null
- }),
- JdkMarshaller: new ClassDescriptor('org.apache.ignite.marshaller.jdk.JdkMarshaller', {})
-};
-
-var javaBuildInClasses = {
- BigDecimal: {className: 'java.math.BigDecimal'},
- Boolean: {className: 'java.lang.Boolean'},
- Byte: {className: 'java.lang.Byte'},
- Date: {className: 'java.sql.Date'},
- Double: {className: 'java.lang.Double'},
- Float: {className: 'java.lang.Float'},
- Integer: {className: 'java.lang.Integer'},
- Long: {className: 'java.lang.Long'},
- Short: {className: 'java.lang.Short'},
- String: {className: 'java.lang.String'},
- Time: {className: 'java.sql.Time'},
- Timestamp: {className: 'java.sql.Timestamp'},
- UUID: {className: 'java.util.UUID'}
-};
-
-function javaBuildInClass(className) {
- var fullClassName = javaBuildInClasses[className];
-
- if (fullClassName)
- return fullClassName.className;
-
- return className;
-}
-
-exports.javaBuildInClass = javaBuildInClass;
-
-/**
- * @param className Class name to check.
- * @returns 'true' if given class name is a java build-in type.
- */
-exports.isJavaBuildInClass = function (className) {
- return utils.isDefined(javaBuildInClasses[className]);
-};
-
-exports.knownClasses = {
- Oracle: new ClassDescriptor('org.apache.ignite.cache.store.jdbc.dialect.OracleDialect', {}),
- DB2: new ClassDescriptor('org.apache.ignite.cache.store.jdbc.dialect.DB2Dialect', {}),
- SQLServer: new ClassDescriptor('org.apache.ignite.cache.store.jdbc.dialect.SQLServerDialect', {}),
- MySQL: new ClassDescriptor('org.apache.ignite.cache.store.jdbc.dialect.MySQLDialect', {}),
- PostgreSQL: new ClassDescriptor('org.apache.ignite.cache.store.jdbc.dialect.BasicJdbcDialect', {}),
- H2: new ClassDescriptor('org.apache.ignite.cache.store.jdbc.dialect.H2Dialect', {})
-};
-
-exports.dataSources = {
- Oracle: 'oracle.jdbc.pool.OracleDataSource',
- DB2: 'com.ibm.db2.jcc.DB2ConnectionPoolDataSource',
- SQLServer: 'com.microsoft.sqlserver.jdbc.SQLServerDataSource',
- MySQL: 'com.mysql.jdbc.jdbc2.optional.MysqlDataSource',
- PostgreSQL: 'org.postgresql.ds.PGPoolingDataSource',
- H2: 'org.h2.jdbcx.JdbcDataSource'
-};
-
-exports.storeFactories = {
- CacheJdbcPojoStoreFactory: new ClassDescriptor('org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory', {
- dataSourceBean: null,
- dialect: {type: 'className'}
- }),
-
- CacheJdbcBlobStoreFactory: new ClassDescriptor('org.apache.ignite.cache.store.jdbc.CacheJdbcBlobStoreFactory', {
- user: null,
- dataSourceBean: null,
- initSchema: null,
- createTableQuery: null,
- loadQuery: null,
- insertQuery: null,
- updateQuery: null,
- deleteQuery: null
- }),
-
- CacheHibernateBlobStoreFactory: new ClassDescriptor('org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreFactory', {
- hibernateProperties: {type: 'propertiesAsList', propVarName: 'props'}
- })
-};
-
-exports.atomicConfiguration = new ClassDescriptor('org.apache.ignite.configuration.AtomicConfiguration', {
- backups: null,
- cacheMode: {type: 'enum', enumClass: 'CacheMode'},
- atomicSequenceReserveSize: null
-});
-
-exports.swapSpaceSpi = new ClassDescriptor('org.apache.ignite.spi.swapspace.file.FileSwapSpaceSpi', {
- baseDirectory: null,
- readStripesNumber: null,
- maximumSparsity: {type: 'float'},
- maxWriteQueueSize: null,
- writeBufferSize: null
-});
-
-exports.transactionConfiguration = new ClassDescriptor('org.apache.ignite.configuration.TransactionConfiguration', {
- defaultTxConcurrency: {type: 'enum', enumClass: 'TransactionConcurrency'},
- transactionIsolation: {type: 'TransactionIsolation', setterName: 'defaultTxIsolation'},
- defaultTxTimeout: null,
- pessimisticTxLogLinger: null,
- pessimisticTxLogSize: null,
- txSerializableEnabled: null
-});
-
-/**
- * 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 = exports.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 undefined;
-};
http://git-wip-us.apache.org/repos/asf/ignite/blob/0b72d82a/modules/control-center-web/src/main/js/routes/generator/docker.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/generator/docker.js b/modules/control-center-web/src/main/js/routes/generator/docker.js
deleted file mode 100644
index 997a7ce..0000000
--- a/modules/control-center-web/src/main/js/routes/generator/docker.js
+++ /dev/null
@@ -1,58 +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.
- */
-
-exports.generateClusterConfiguration = function (cluster, os) {
- if (!os)
- os = 'debian:8';
-
- return "" +
- "# Start from a OS image.\n" +
- "FROM " + os + "\n" +
- "\n" +
- "# Install tools.\n" +
- "RUN apt-get update && apt-get install -y --fix-missing \\\n" +
- " wget \\\n" +
- " dstat \\\n" +
- " maven \\\n" +
- " git\n" +
- "\n" +
- "# Install Oracle JDK.\n" +
- "RUN mkdir /opt/jdk\n" +
- "\n" +
- "RUN wget --header \"Cookie: oraclelicense=accept-securebackup-cookie\" \\\n" +
- " http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.tar.gz\n" +
- "\n" +
- "RUN tar -zxf jdk-7u79-linux-x64.tar.gz -C /opt/jdk\n" +
- "\n" +
- "RUN rm jdk-7u79-linux-x64.tar.gz\n" +
- "\n" +
- "RUN update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.7.0_79/bin/java 100\n" +
- "\n" +
- "RUN update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.7.0_79/bin/javac 100\n" +
- "\n" +
- "# Sets java variables.\n" +
- "ENV JAVA_HOME /opt/jdk/jdk1.7.0_79/\n" +
- "\n" +
- "# Create working directory\n" +
- "WORKDIR /home\n" +
- "\n" +
- "RUN wget -O ignite.zip http://tiny.cc/updater/download_ignite.php && unzip ignite.zip && rm ignite.zip\n" +
- "\n" +
- "COPY *.xml /tmp/\n" +
- "\n" +
- "RUN mv /tmp/*.xml /home/$(ls)/config";
-};
http://git-wip-us.apache.org/repos/asf/ignite/blob/0b72d82a/modules/control-center-web/src/main/js/routes/generator/generator-common.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/generator/generator-common.js b/modules/control-center-web/src/main/js/routes/generator/generator-common.js
new file mode 100644
index 0000000..0ad761c
--- /dev/null
+++ b/modules/control-center-web/src/main/js/routes/generator/generator-common.js
@@ -0,0 +1,254 @@
+/*
+ * 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.
+ */
+
+if (typeof window === 'undefined') {
+ $dataStructures = require('../../helpers/data-structures');
+}
+
+function _addLeadingZero(numberStr, minSize) {
+ if (typeof (numberStr) != 'string')
+ numberStr = '' + numberStr;
+
+ while (numberStr.length < minSize) {
+ numberStr = '0' + numberStr;
+ }
+
+ return numberStr;
+}
+
+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);
+}
+
+$generatorCommon = {};
+
+$generatorCommon.mainComment = function mainComment() {
+ return 'This configuration was generated by Ignite Control Center (' + _formatDate(new Date()) + ')';
+};
+
+$generatorCommon.builder = function () {
+ var res = [];
+
+ res.deep = 0;
+ res.lineStart = true;
+
+ res.append = function (s) {
+ if (this.lineStart) {
+ for (var i = 0; i < this.deep; i++)
+ this.push(' ');
+
+ this.lineStart = false;
+ }
+
+ this.push(s);
+
+ return this;
+ };
+
+ res.line = function (s) {
+ if (s)
+ this.append(s);
+
+ this.push('\n');
+ this.lineStart = true;
+
+ return this;
+ };
+
+ res.startBlock = function (s) {
+ if (s)
+ this.append(s);
+
+ this.push('\n');
+ this.lineStart = true;
+ this.deep++;
+
+ return this;
+ };
+
+ res.endBlock = function (s) {
+ this.deep--;
+
+ if (s)
+ this.append(s);
+
+ this.push('\n');
+ this.lineStart = true;
+
+ return this;
+ };
+
+ res.emptyLineIfNeeded = function () {
+ if (this.needEmptyLine) {
+ this.line();
+
+ this.needEmptyLine = false;
+
+ return true;
+ }
+
+ return false;
+ };
+
+ res.imports = {};
+
+ res.importClass = function (clsName) {
+ var fullClassName = $dataStructures.fullClassName(clsName);
+
+ var dotIdx = fullClassName.lastIndexOf('.');
+
+ var 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;
+ };
+
+ /**
+ * @returns String with "java imports" section.
+ */
+ res.generateImports = function () {
+ var res = [];
+
+ for (var clsName in this.imports) {
+ if (this.imports.hasOwnProperty(clsName) && this.imports[clsName].lastIndexOf('java.lang.', 0) != 0)
+ res.push('import ' + this.imports[clsName] + ';');
+ }
+
+ res.sort();
+
+ return res.join('\n')
+ };
+
+ return res;
+};
+
+function _classDescriptor(className, fields) {
+ return {className: className, fields: fields}
+}
+
+$generatorCommon.EVICTION_POLICIES = {
+ LRU: _classDescriptor('org.apache.ignite.cache.eviction.lru.LruEvictionPolicy',
+ {batchSize: null, maxMemorySize: null, maxSize: null}),
+ RND: _classDescriptor('org.apache.ignite.cache.eviction.random.RandomEvictionPolicy',
+ {maxSize: null}),
+ FIFO: _classDescriptor('org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy',
+ {batchSize: null, maxMemorySize: null, maxSize: null}),
+ SORTED: _classDescriptor('org.apache.ignite.cache.eviction.sorted.SortedEvictionPolicy',
+ {batchSize: null, maxMemorySize: null, maxSize: null})
+};
+
+$generatorCommon.MARSHALLERS = {
+ OptimizedMarshaller: _classDescriptor('org.apache.ignite.marshaller.optimized.OptimizedMarshaller',
+ {poolSize: null, requireSerializable: null }),
+ JdkMarshaller: _classDescriptor('org.apache.ignite.marshaller.jdk.JdkMarshaller', {})
+};
+
+$generatorCommon.KNOWN_CLASSES = {
+ Oracle: _classDescriptor('org.apache.ignite.cache.store.jdbc.dialect.OracleDialect', {}),
+ DB2: _classDescriptor('org.apache.ignite.cache.store.jdbc.dialect.DB2Dialect', {}),
+ SQLServer: _classDescriptor('org.apache.ignite.cache.store.jdbc.dialect.SQLServerDialect', {}),
+ MySQL: _classDescriptor('org.apache.ignite.cache.store.jdbc.dialect.MySQLDialect', {}),
+ PostgreSQL: _classDescriptor('org.apache.ignite.cache.store.jdbc.dialect.BasicJdbcDialect', {}),
+ H2: _classDescriptor('org.apache.ignite.cache.store.jdbc.dialect.H2Dialect', {})
+};
+
+$generatorCommon.DATA_SOURCES = {
+ Oracle: 'oracle.jdbc.pool.OracleDataSource',
+ DB2: 'com.ibm.db2.jcc.DB2ConnectionPoolDataSource',
+ SQLServer: 'com.microsoft.sqlserver.jdbc.SQLServerDataSource',
+ MySQL: 'com.mysql.jdbc.jdbc2.optional.MysqlDataSource',
+ PostgreSQL: 'org.postgresql.ds.PGPoolingDataSource',
+ H2: 'org.h2.jdbcx.JdbcDataSource'
+};
+
+$generatorCommon.STORE_FACTORIES = {
+ CacheJdbcPojoStoreFactory: _classDescriptor('org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory',
+ {dataSourceBean: null, dialect: {type: 'className'}}),
+ CacheJdbcBlobStoreFactory: _classDescriptor('org.apache.ignite.cache.store.jdbc.CacheJdbcBlobStoreFactory',
+ {user: null, dataSourceBean: null, initSchema: null, createTableQuery: null, loadQuery: null, insertQuery: null, updateQuery: null, deleteQuery: null}),
+ CacheHibernateBlobStoreFactory: _classDescriptor('org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreFactory',
+ {hibernateProperties: {type: 'propertiesAsList', propVarName: 'props'}})
+};
+
+$generatorCommon.ATOMIC_CONFIGURATION = _classDescriptor('org.apache.ignite.configuration.AtomicConfiguration',
+ {backups: null, cacheMode: {type: 'enum', enumClass: 'CacheMode'}, atomicSequenceReserveSize: null});
+
+$generatorCommon.SWAP_SPACE_SPI = _classDescriptor('org.apache.ignite.spi.swapspace.file.FileSwapSpaceSpi',
+ {baseDirectory: null, readStripesNumber: null, maximumSparsity: {type: 'float'}, maxWriteQueueSize: null, writeBufferSize: null});
+
+$generatorCommon.TRANSACTION_CONFIGURATION = _classDescriptor('org.apache.ignite.configuration.TransactionConfiguration',
+ {
+ defaultTxConcurrency: {type: 'enum', enumClass: 'TransactionConcurrency'},
+ transactionIsolation: {type: 'TransactionIsolation', setterName: 'defaultTxIsolation'},
+ defaultTxTimeout: null,
+ pessimisticTxLogLinger: null,
+ pessimisticTxLogSize: null,
+ txSerializableEnabled: null}
+);
+
+/**
+ * Generate properties file with properties stubs for stores data sources.
+ *
+ * @param cluster Configuration to process.
+ * @returns {string} Generated content.
+ */
+$generatorCommon.generateProperties = function (cluster) {
+ var res = exports.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 undefined;
+};
+
+if (typeof window === 'undefined') {
+ module.exports = $generatorCommon;
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0b72d82a/modules/control-center-web/src/main/js/routes/generator/generator-docker.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/generator/generator-docker.js b/modules/control-center-web/src/main/js/routes/generator/generator-docker.js
new file mode 100644
index 0000000..b22b9b9
--- /dev/null
+++ b/modules/control-center-web/src/main/js/routes/generator/generator-docker.js
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ */
+
+exports.generateClusterConfiguration = function (cluster, os) {
+ if (!os)
+ os = 'debian:8';
+
+ return '# Start from a OS image.\n' +
+ 'FROM ' + os + '\n' +
+ '\n' +
+ '# Install tools.\n' +
+ 'RUN apt-get update && apt-get install -y --fix-missing \\\n' +
+ ' wget \\\n' +
+ ' dstat \\\n' +
+ ' maven \\\n' +
+ ' git\n' +
+ '\n' +
+ '# Install Oracle JDK.\n' +
+ 'RUN mkdir /opt/jdk\n' +
+ '\n' +
+ 'RUN wget --header \"Cookie: oraclelicense=accept-securebackup-cookie\" \\\n' +
+ ' http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.tar.gz\n' +
+ '\n' +
+ 'RUN tar -zxf jdk-7u79-linux-x64.tar.gz -C /opt/jdk\n' +
+ '\n' +
+ 'RUN rm jdk-7u79-linux-x64.tar.gz\n' +
+ '\n' +
+ 'RUN update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.7.0_79/bin/java 100\n' +
+ '\n' +
+ 'RUN update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.7.0_79/bin/javac 100\n' +
+ '\n' +
+ '# Sets java variables.\n' +
+ 'ENV JAVA_HOME /opt/jdk/jdk1.7.0_79/\n' +
+ '\n' +
+ '# Create working directory\n' +
+ 'WORKDIR /home\n' +
+ '\n' +
+ 'RUN wget -O ignite.zip http://tiny.cc/updater/download_ignite.php && unzip ignite.zip && rm ignite.zip\n' +
+ '\n' +
+ 'COPY *.xml /tmp/\n' +
+ '\n' +
+ 'RUN mv /tmp/*.xml /home/$(ls)/config';
+};