stack_service_component.js 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. var App = require('app');
  19. /**
  20. * This model loads all serviceComponents supported by the stack
  21. * @type {*}
  22. */
  23. App.StackServiceComponent = DS.Model.extend({
  24. componentName: DS.attr('string'),
  25. serviceName: DS.attr('string'),
  26. componentCategory: DS.attr('string'),
  27. isMaster: DS.attr('boolean'),
  28. isClient: DS.attr('boolean'),
  29. stackName: DS.attr('string'),
  30. stackVersion: DS.attr('string'),
  31. displayName: function() {
  32. return App.format.components[this.get('componentName')];
  33. }.property('componentName'),
  34. isSlave: function() {
  35. return this.get('componentCategory') === 'SLAVE';
  36. }.property('componentCategory'),
  37. isRestartable: function() {
  38. return !this.get('isClient');
  39. }.property('isClient'),
  40. isReassignable: function() {
  41. return ['NAMENODE', 'SECONDARY_NAMENODE', 'JOBTRACKER', 'RESOURCEMANAGER'].contains(this.get('componentName'));
  42. }.property('componentName'),
  43. isDeletable: function() {
  44. return ['SUPERVISOR', 'HBASE_MASTER', 'DATANODE', 'TASKTRACKER', 'NODEMANAGER', 'HBASE_REGIONSERVER'].contains(this.get('componentName'));
  45. }.property('componentName'),
  46. isRollinRestartAllowed: function() {
  47. return ["DATANODE", "TASKTRACKER", "NODEMANAGER", "HBASE_REGIONSERVER", "SUPERVISOR"].contains(this.get('componentName'));
  48. }.property('componentName'),
  49. isDecommissionAllowed: function() {
  50. return ["DATANODE", "TASKTRACKER", "NODEMANAGER", "HBASE_REGIONSERVER"].contains(this.get('componentName'));
  51. }.property('componentName'),
  52. isRefreshConfigsAllowed: function() {
  53. return ["FLUME_HANDLER"].contains(this.get('componentName'));
  54. }.property('componentName'),
  55. isAddableToHost: function() {
  56. return ["DATANODE", "TASKTRACKER", "NODEMANAGER", "HBASE_REGIONSERVER", "HBASE_MASTER", "ZOOKEEPER_SERVER", "SUPERVISOR"].contains(this.get('componentName'));
  57. }.property('componentName'),
  58. isShownOnInstallerAssignMasterPage: function() {
  59. var component = this.get('componentName');
  60. var mastersNotShown = ['MYSQL_SERVER','JOURNALNODE'];
  61. return ((this.get('isMaster') && !mastersNotShown.contains(component)) || component === 'APP_TIMELINE_SERVER');
  62. }.property('isMaster','componentName')
  63. });
  64. App.StackServiceComponent.FIXTURES = [];