|
15 | 15 | from wlsdeploy.aliases.model_constants import DRIVER_PARAMS_TRUSTSTORE_PROPERTY
|
16 | 16 | from wlsdeploy.aliases.model_constants import DRIVER_PARAMS_TRUSTSTOREPWD_PROPERTY
|
17 | 17 | from wlsdeploy.aliases.model_constants import DRIVER_PARAMS_TRUSTSTORETYPE_PROPERTY
|
| 18 | +from wlsdeploy.aliases.model_constants import DRIVER_PARAMS_USER_PROPERTY |
| 19 | +from wlsdeploy.aliases.model_constants import JDBC_DRIVER_PARAMS |
| 20 | +from wlsdeploy.aliases.model_constants import JDBC_DRIVER_PARAMS_PROPERTIES |
| 21 | +from wlsdeploy.aliases.model_constants import JDBC_RESOURCE |
| 22 | +from wlsdeploy.aliases.model_constants import JDBC_SYSTEM_RESOURCE |
18 | 23 | from wlsdeploy.aliases.model_constants import STORE_TYPE_SSO
|
19 | 24 | from wlsdeploy.logging.platform_logger import get_logged_value
|
20 | 25 | from wlsdeploy.logging.platform_logger import PlatformLogger
|
| 26 | +from wlsdeploy.util import dictionary_utils |
21 | 27 | from wlsdeploy.util import string_utils
|
22 | 28 |
|
| 29 | +OPSS_DATA_SOURCE_NAME = 'opss-data-source' |
| 30 | + |
23 | 31 |
|
24 | 32 | class JpsConfigHelper(object):
|
25 | 33 | _logger = PlatformLogger('wlsdeploy.create')
|
26 | 34 | _class_name = 'JpsConfigHelper'
|
27 | 35 |
|
28 |
| - def __init__(self, model_context, rcu_db_info): |
| 36 | + def __init__(self, model_object, model_context, rcu_db_info): |
| 37 | + self._model_object = model_object |
29 | 38 | self._model_context = model_context
|
30 | 39 | self._rcu_db_info = rcu_db_info
|
31 | 40 | self._use_ssl = rcu_db_info.is_use_atp() or rcu_db_info.is_use_ssl()
|
| 41 | + self._opss_data_source_model_props = self.__get_opss_data_source_model_properties() |
32 | 42 |
|
33 | 43 | def fix_jps_config(self):
|
34 | 44 | _method_name = 'fix_jps_config'
|
@@ -121,12 +131,35 @@ def __set_property(self, dom_tree, prop, name, value, logMask=False):
|
121 | 131 | else:
|
122 | 132 | self._logger.entering(name, value, logMask, class_name=self._class_name, method_name=_method_name)
|
123 | 133 |
|
124 |
| - if not string_utils.is_empty(value): |
| 134 | + value_to_set = dictionary_utils.get_element(self._opss_data_source_model_props, name, value) |
| 135 | + if not string_utils.is_empty(value_to_set): |
125 | 136 | property_element = dom_tree.createElement('property')
|
126 | 137 | property_element.setAttribute("name", name)
|
127 |
| - property_element.setAttribute("value", value) |
| 138 | + property_element.setAttribute("value", value_to_set) |
128 | 139 | prop.appendChild(property_element)
|
129 | 140 | newline = dom_tree.createTextNode('\n')
|
130 | 141 | prop.appendChild(newline)
|
131 | 142 |
|
132 | 143 | self._logger.exiting(class_name=self._class_name, method_name=_method_name)
|
| 144 | + |
| 145 | + def __get_opss_data_source_model_properties(self): |
| 146 | + _method_name = '__get_opss_data_source_model_properties' |
| 147 | + self._logger.entering(class_name=self._class_name, method_name=_method_name) |
| 148 | + |
| 149 | + model_resources_dict = self._model_object.get_model_resources() |
| 150 | + model_data_sources_dict = dictionary_utils.get_dictionary_element(model_resources_dict, JDBC_SYSTEM_RESOURCE) |
| 151 | + model_opss_data_source_dict = \ |
| 152 | + dictionary_utils.get_dictionary_element(model_data_sources_dict, OPSS_DATA_SOURCE_NAME) |
| 153 | + model_jdbc_resource_dict = dictionary_utils.get_dictionary_element(model_opss_data_source_dict, JDBC_RESOURCE) |
| 154 | + model_driver_params_dict = dictionary_utils.get_dictionary_element(model_jdbc_resource_dict, JDBC_DRIVER_PARAMS) |
| 155 | + model_driver_props_dict = \ |
| 156 | + dictionary_utils.get_dictionary_element(model_driver_params_dict, JDBC_DRIVER_PARAMS_PROPERTIES) |
| 157 | + |
| 158 | + opss_model_props = dict() |
| 159 | + for prop_key, prop_value in model_driver_props_dict.iteritems(): |
| 160 | + if prop_key == DRIVER_PARAMS_USER_PROPERTY: |
| 161 | + continue |
| 162 | + opss_model_props[prop_key] = prop_value |
| 163 | + |
| 164 | + self._logger.exiting(class_name=self._class_name, method_name=_method_name) |
| 165 | + return opss_model_props |
0 commit comments