db_properties_info.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. module.exports = {
  20. /**
  21. * object that shows property names for different kind of config properties
  22. * - radio button property (db_selector) - main config on which can depend other core properties
  23. * - properties used to generate connection url (host_name, db_name)
  24. * - properties that should be updated on radio buttons change (connection_url, driver, db_type, sql_jar_connector)
  25. * @see <code>setConnectionUrl<code> for details for connection_url
  26. * - properties that should be hidden in special case (user_name, password)
  27. * @see <code>handleSpecialUserPassProperties<code> method
  28. * @type {object}
  29. */
  30. dpPropertiesByServiceMap: {
  31. 'HIVE': {
  32. db_selector: 'hive_database',
  33. db_name: 'ambari.hive.db.schema.name',
  34. connection_url: 'javax.jdo.option.ConnectionURL',
  35. db_type: 'hive_database_type',
  36. driver: 'javax.jdo.option.ConnectionDriverName',
  37. user_name: 'javax.jdo.option.ConnectionUserName',
  38. password: 'javax.jdo.option.ConnectionPassword'
  39. },
  40. 'OOZIE': {
  41. db_selector: 'oozie_database',
  42. db_name: 'oozie.db.schema.name',
  43. connection_url: 'oozie.service.JPAService.jdbc.url',
  44. driver: 'oozie.service.JPAService.jdbc.driver',
  45. user_name: 'oozie.service.JPAService.jdbc.username',
  46. password: 'oozie.service.JPAService.jdbc.password'
  47. }
  48. },
  49. /**
  50. * object that shows default(recommended) values for different db type;
  51. * properties that should have default value ['connection_url', 'driver', 'sql_jar_connector', 'db_type']
  52. * some properties can be skipped but be sure they are not used.
  53. * @type {object}
  54. */
  55. dpPropertiesMap: {
  56. 'MYSQL': {
  57. 'connection_url': 'jdbc:mysql://{0}/{1}',
  58. /** in case property has different default value for specific service it can be overriden in such way **/
  59. 'HIVE': {
  60. 'connection_url': 'jdbc:mysql://{0}/{1}?createDatabaseIfNotExist=true'
  61. },
  62. 'driver': 'com.mysql.jdbc.Driver',
  63. 'sql_jar_connector': '/usr/share/java/mysql-connector-java.jar',
  64. 'db_type': 'mysql'
  65. },
  66. 'POSTGRES': {
  67. 'connection_url': 'jdbc:postgresql://{0}:5432/{1}',
  68. 'driver': 'org.postgresql.Driver',
  69. 'sql_jar_connector': '/usr/share/java/postgresql.jar',
  70. 'db_type': 'postgres'
  71. },
  72. 'ORACLE': {
  73. 'connection_url': 'jdbc:oracle:thin:@//{0}:1521/{1}',
  74. 'driver': 'oracle.jdbc.driver.OracleDriver',
  75. 'sql_jar_connector': '/usr/share/java/ojdbc6.jar',
  76. 'db_type': 'oracle'
  77. },
  78. 'MSSQL': {
  79. 'connection_url': 'jdbc:sqlserver://{0};databaseName={1}',
  80. 'driver': 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
  81. 'sql_jar_connector': '/usr/share/java/sqljdbc4.jar',
  82. 'db_type': 'mssql'
  83. },
  84. 'MSSQL2': {
  85. 'connection_url': 'jdbc:sqlserver://{0};databaseName={1};integratedSecurity=true',
  86. 'driver': 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
  87. 'sql_jar_connector': '/usr/share/java/sqljdbc4.jar',
  88. 'db_type': 'mssql'
  89. },
  90. /** TODO: Remove SQLA from the list of databases once Ranger DB_FLAVOR=SQLA is replaced with SQL Anywhere */
  91. 'SQLA': {
  92. 'connection_url': 'jdbc:sqlanywhere:host={0};database={1}',
  93. 'driver': 'sap.jdbc4.sqlanywhere.IDriver',
  94. 'sql_jar_connector': '/path_to_driver/sqla-client-jdbc.tar.gz',
  95. 'db_type': 'sqlanywhere'
  96. },
  97. 'ANYWHERE': {
  98. 'connection_url': 'jdbc:sqlanywhere:host={0};database={1}',
  99. 'driver': 'sap.jdbc4.sqlanywhere.IDriver',
  100. 'sql_jar_connector': '/path_to_driver/sqla-client-jdbc.tar.gz',
  101. 'db_type': 'sqlanywhere'
  102. },
  103. 'DERBY': {
  104. 'connection_url': 'jdbc:derby:${oozie.data.dir}/${oozie.db.schema.name}-db;create=true',
  105. 'driver': 'org.apache.derby.jdbc.EmbeddedDriver'
  106. }
  107. }
  108. };