From 23c059dfde4354f28378316dbab910a31398c246 Mon Sep 17 00:00:00 2001 From: johnny_shum Date: Thu, 7 Sep 2023 18:26:39 +0000 Subject: [PATCH] Add EnableJMSDBPersistence and EnabelJTALogDBPersistence in domainInfo --- .../wlsdeploy/aliases/model_constants.py | 2 + .../wlsdeploy/tool/create/domain_creator.py | 46 +++++++++++++++++++ .../python/wlsdeploy/tool/util/wlst_helper.py | 38 +++++++++++++++ .../aliases/category_modules/DomainInfo.json | 2 + .../deploy/messages/wlsdeploy_rb.properties | 2 + 5 files changed, 90 insertions(+) diff --git a/core/src/main/python/wlsdeploy/aliases/model_constants.py b/core/src/main/python/wlsdeploy/aliases/model_constants.py index 790d3248e2..de6c870e95 100644 --- a/core/src/main/python/wlsdeploy/aliases/model_constants.py +++ b/core/src/main/python/wlsdeploy/aliases/model_constants.py @@ -118,6 +118,8 @@ DOMAIN_VERSION = 'DomainVersion' DYNAMIC_SERVERS = 'DynamicServers' EMBEDDED_LDAP = 'EmbeddedLDAP' +ENABLE_JMS_DB_PERSISTENCE = 'EnableJMSStoreDBPersistence' +ENABLE_JTALOG_DB_PERSISTENCE = 'EnableJTATLogDBPersistence' ERROR_DESTINATION = 'ErrorDestination' EXECUTE_QUEUE = 'ExecuteQueue' EXPRESSION = 'Expression' diff --git a/core/src/main/python/wlsdeploy/tool/create/domain_creator.py b/core/src/main/python/wlsdeploy/tool/create/domain_creator.py index 416eb4e250..431761163d 100644 --- a/core/src/main/python/wlsdeploy/tool/create/domain_creator.py +++ b/core/src/main/python/wlsdeploy/tool/create/domain_creator.py @@ -41,6 +41,8 @@ from wlsdeploy.aliases.model_constants import DRIVER_PARAMS_TRUSTSTORETYPE_PROPERTY from wlsdeploy.aliases.model_constants import DRIVER_PARAMS_TRUSTSTORE_PROPERTY from wlsdeploy.aliases.model_constants import DRIVER_PARAMS_USER_PROPERTY +from wlsdeploy.aliases.model_constants import ENABLE_JMS_DB_PERSISTENCE +from wlsdeploy.aliases.model_constants import ENABLE_JTALOG_DB_PERSISTENCE from wlsdeploy.aliases.model_constants import FRONTEND_HOST from wlsdeploy.aliases.model_constants import JDBC_DRIVER_PARAMS_PROPERTIES from wlsdeploy.aliases.model_constants import JDBC_SYSTEM_RESOURCE @@ -78,6 +80,7 @@ from wlsdeploy.aliases.model_constants import WEB_SERVICE_SECURITY from wlsdeploy.aliases.model_constants import XML_ENTITY_CACHE from wlsdeploy.aliases.model_constants import XML_REGISTRY +from wlsdeploy.aliases.validation_codes import ValidationCodes from wlsdeploy.exception import exception_helper from wlsdeploy.exception.expection_types import ExceptionType from wlsdeploy.tool.create import atp_helper @@ -618,6 +621,10 @@ def __extend_domain_with_select_template(self, domain_home): self.__set_core_domain_params() self.__set_app_dir() + + self.__enable_jms_db_persistence_if_set() + self.__enable_jta_tlog_db_persistence_if_set() + if len(extension_templates) > 0: self.__configure_fmw_infra_database() self.__configure_opss_secrets() @@ -1333,6 +1340,45 @@ def __set_app_dir(self): self.logger.exiting(class_name=self.__class_name, method_name=_method_name) return + def __enable_jms_db_persistence_if_set(self): + """ + Enable jms db persistence if set + """ + _method_name = '__enable_jms_db_persistence_if_set' + + self.logger.entering(class_name=self.__class_name, method_name=_method_name) + if ENABLE_JMS_DB_PERSISTENCE in self._domain_info: + location = self.aliases.get_model_section_attribute_location(DOMAIN_INFO) + result, __ = self.aliases.is_valid_model_attribute_name(location, + ENABLE_JMS_DB_PERSISTENCE) + + if result == ValidationCodes.VALID: + enable_jms_db = self._domain_info[ENABLE_JMS_DB_PERSISTENCE] + self.wlst_helper.enable_jms_store_db_persistence(enable_jms_db) + + self.logger.exiting(class_name=self.__class_name, method_name=_method_name) + return + + def __enable_jta_tlog_db_persistence_if_set(self): + """ + Enable jta tlog db persistence if set + """ + _method_name = '__enable_jta_tlog_db_persistence_if_set' + + self.logger.entering(class_name=self.__class_name, method_name=_method_name) + if ENABLE_JTALOG_DB_PERSISTENCE in self._domain_info: + location = self.aliases.get_model_section_attribute_location(DOMAIN_INFO) + result, __ = self.aliases.is_valid_model_attribute_name(location, + ENABLE_JTALOG_DB_PERSISTENCE) + + if result == ValidationCodes.VALID: + enable_jta_db = self._domain_info[ENABLE_JTALOG_DB_PERSISTENCE] + self.wlst_helper.enable_jta_tlog_store_db_persistence(enable_jta_db) + + + self.logger.exiting(class_name=self.__class_name, method_name=_method_name) + return + def __set_domain_name(self): _method_name = '__set_domain_name' # Stash the default name since the SecurityConfiguration subfolder name does not change diff --git a/core/src/main/python/wlsdeploy/tool/util/wlst_helper.py b/core/src/main/python/wlsdeploy/tool/util/wlst_helper.py index a4e63e9fdd..848ead4988 100644 --- a/core/src/main/python/wlsdeploy/tool/util/wlst_helper.py +++ b/core/src/main/python/wlsdeploy/tool/util/wlst_helper.py @@ -1604,6 +1604,44 @@ def get_domain_runtime_service(self): self.__logger.exiting(class_name=self.__class_name, method_name=_method_name, result=drs) return drs + def enable_jta_tlog_store_db_persistence(self, jta_db_enabled): + """ + Enable jta transaction log database store persistence if set + """ + _method_name = 'enable_jta_tlog_store_db_persistence' + self.__logger.entering(class_name=self.__class_name, method_name=_method_name) + try: + if self.__load_global('isJTATLogPersistenceConfigurable')() and not \ + self.__load_global('isJTATLogDBPersistenceSet')() and \ + jta_db_enabled: + self.__load_global('enableJTATLogDBPersistence')(True) + + except self.__load_global('WLSTException'), e: + pwe = exception_helper.create_exception(self.__exception_type, 'WLSDEPY-00132', + _format_exception(e), error=e) + self.__logger.throwing(class_name=self.__class_name, method_name=_method_name, error=pwe) + raise pwe + self.__logger.exiting(class_name=self.__class_name, method_name=_method_name) + + def enable_jms_store_db_persistence(self, jms_db_enabled): + """ + Enable jms database store persistence if set + """ + _method_name = 'enable_jms_store_db_persistence' + self.__logger.entering(class_name=self.__class_name, method_name=_method_name) + try: + if self.__load_global('isJMSStorePersistenceConfigurable')() and not \ + self.__load_global('isJMSStoreDBPersistenceSet')() and \ + jms_db_enabled: + self.__load_global('enableJMSStoreDBPersistence')(True) + + except self.__load_global('WLSTException'), e: + pwe = exception_helper.create_exception(self.__exception_type, 'WLSDEPY-00131', + _format_exception(e), error=e) + self.__logger.throwing(class_name=self.__class_name, method_name=_method_name, error=pwe) + raise pwe + self.__logger.exiting(class_name=self.__class_name, method_name=_method_name) + def __ls(self, method_name, ls_type, path=None, log_throwing=True): """ Private helper method shared by various API methods diff --git a/core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/DomainInfo.json b/core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/DomainInfo.json index 7e769eea91..6bf02504c7 100644 --- a/core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/DomainInfo.json +++ b/core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/DomainInfo.json @@ -12,6 +12,8 @@ "DynamicClusterServerGroupTargetingLimits": [ {"version": "[12.2.1.1,)", "wlst_mode": "both", "wlst_name": "dynamicClusterServerGroupTargetingLimits", "wlst_path": "WP001", "default_value": null, "wlst_type": "dict" } ], "ServerStartMode": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "ServerStartMode", "wlst_path": "WP001", "default_value": null, "wlst_type": "string" } ], "UseSampleDatabase": [ {"version": "[12.2.1,)", "wlst_mode": "offline", "wlst_name": "UseSampleDatabase", "wlst_path": "WP001", "default_value": null, "wlst_type": "string" } ], + "EnableJMSStoreDBPersistence": [ {"version": "[12.2.1.1,)", "wlst_mode": "offline", "wlst_name": "EnableJMSStoreDBPersistence", "wlst_path": "WP001", "default_value": false, "wlst_type": "boolean" } ], + "EnableJTATLogDBPersistence": [ {"version": "[12.2.1.1,)", "wlst_mode": "offline", "wlst_name": "EnableJTATLogDBPersistence", "wlst_path": "WP001", "default_value": false, "wlst_type": "boolean" } ], "domainBin": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "domainBin", "wlst_path": "WP001", "default_value": null, "wlst_type": "list", "uses_path_tokens": "true" } ], "domainLibraries": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "domainLibraries", "wlst_path": "WP001", "default_value": null, "wlst_type": "list", "uses_path_tokens": "true" } ] }, diff --git a/core/src/main/resources/oracle/weblogic/deploy/messages/wlsdeploy_rb.properties b/core/src/main/resources/oracle/weblogic/deploy/messages/wlsdeploy_rb.properties index 284150d5c2..ba41a9e972 100644 --- a/core/src/main/resources/oracle/weblogic/deploy/messages/wlsdeploy_rb.properties +++ b/core/src/main/resources/oracle/weblogic/deploy/messages/wlsdeploy_rb.properties @@ -113,6 +113,8 @@ WLSDPLY-00127=Unable to load the DomainRuntimeService from the WLST globals : {0 WLSDPLY-00128=setTopologyProfile({0}) failed: {1} WLSDPLY-00129=Error calling isSet() for attribute {0} at location {1}: {2} WLSDPLY-00130=Failed to get the current MBean tree: {0} +WLSDEPY-00131=Failed to set JMS store to use database store: {0} +WLSDEPY-00132=Failed to set JTA transaction log store to use database store: {0} ############################################################################### # Util messages (1000 - 3999) #