From 4facb50b4734375d9d545a86734809fcaee67921 Mon Sep 17 00:00:00 2001 From: richard_killen Date: Mon, 27 Jan 2025 15:43:27 +0000 Subject: [PATCH] Discover and deploy managed MBean folders in resources model section --- .../python/wlsdeploy/aliases/alias_entries.py | 8 +- .../wlsdeploy/aliases/model_constants.py | 2 +- .../tool/deploy/resources_deployer.py | 21 +++- .../discover/global_resources_discoverer.py | 4 + .../tool/discover/topology_discoverer.py | 99 ------------------- .../ManagedExecutorServiceTemplate.json | 3 +- ...agedScheduledExecutorServiceTemplate.json} | 3 +- .../ManagedThreadFactoryTemplate.json | 3 +- 8 files changed, 38 insertions(+), 105 deletions(-) rename core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/{ManagedScheduledExecutorService.json => ManagedScheduledExecutorServiceTemplate.json} (87%) diff --git a/core/src/main/python/wlsdeploy/aliases/alias_entries.py b/core/src/main/python/wlsdeploy/aliases/alias_entries.py index 91c52fdfd6..a8b00983b5 100644 --- a/core/src/main/python/wlsdeploy/aliases/alias_entries.py +++ b/core/src/main/python/wlsdeploy/aliases/alias_entries.py @@ -1,5 +1,5 @@ """ -Copyright (c) 2017, 2024, Oracle and/or its affiliates. +Copyright (c) 2017, 2025, Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. """ import copy @@ -61,6 +61,9 @@ from wlsdeploy.aliases.model_constants import HEALTH_SCORE from wlsdeploy.aliases.model_constants import JOLT_CONNECTION_POOL from wlsdeploy.aliases.model_constants import JPA +from wlsdeploy.aliases.model_constants import MANAGED_EXECUTOR_SERVICE_TEMPLATE +from wlsdeploy.aliases.model_constants import MANAGED_SCHEDULED_EXECUTOR_SERVICE_TEMPLATE +from wlsdeploy.aliases.model_constants import MANAGED_THREAD_FACTORY_TEMPLATE from wlsdeploy.aliases.model_constants import ODL_CONFIGURATION from wlsdeploy.aliases.model_constants import OHS from wlsdeploy.aliases.model_constants import OPSS_INITIALIZATION @@ -146,6 +149,9 @@ class AliasEntries(object): 'JMSSystemResource', JOLT_CONNECTION_POOL, 'MailSession', + MANAGED_EXECUTOR_SERVICE_TEMPLATE, + MANAGED_SCHEDULED_EXECUTOR_SERVICE_TEMPLATE, + MANAGED_THREAD_FACTORY_TEMPLATE, 'MessagingBridge', ODL_CONFIGURATION, OHS, diff --git a/core/src/main/python/wlsdeploy/aliases/model_constants.py b/core/src/main/python/wlsdeploy/aliases/model_constants.py index 35e97d0d89..9291667930 100644 --- a/core/src/main/python/wlsdeploy/aliases/model_constants.py +++ b/core/src/main/python/wlsdeploy/aliases/model_constants.py @@ -184,7 +184,7 @@ MAIL_SESSION_OVERRIDE = 'MailSessionOverride' MAIL_SESSION_PROPERTIES = 'Properties' MANAGED_EXECUTOR_SERVICE_TEMPLATE = 'ManagedExecutorServiceTemplate' -MANAGED_SCHEDULED_EXECUTOR_SERVICE = 'ManagedScheduledExecutorService' +MANAGED_SCHEDULED_EXECUTOR_SERVICE_TEMPLATE = 'ManagedScheduledExecutorServiceTemplate' MANAGED_THREAD_FACTORY_TEMPLATE = 'ManagedThreadFactoryTemplate' MAX_DYNAMIC_SERVER_COUNT = 'MaximumDynamicServerCount' MAX_THREADS_CONSTRAINT = 'MaxThreadsConstraint' diff --git a/core/src/main/python/wlsdeploy/tool/deploy/resources_deployer.py b/core/src/main/python/wlsdeploy/tool/deploy/resources_deployer.py index 25bb9fa876..085f8cc6e8 100644 --- a/core/src/main/python/wlsdeploy/tool/deploy/resources_deployer.py +++ b/core/src/main/python/wlsdeploy/tool/deploy/resources_deployer.py @@ -1,8 +1,11 @@ """ -Copyright (c) 2017, 2024, Oracle and/or its affiliates. +Copyright (c) 2017, 2025, Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. """ import wlsdeploy.util.dictionary_utils as dictionary_utils +from wlsdeploy.aliases.model_constants import MANAGED_EXECUTOR_SERVICE_TEMPLATE +from wlsdeploy.aliases.model_constants import MANAGED_SCHEDULED_EXECUTOR_SERVICE_TEMPLATE +from wlsdeploy.aliases.model_constants import MANAGED_THREAD_FACTORY_TEMPLATE from wlsdeploy.aliases.model_constants import SHUTDOWN_CLASS from wlsdeploy.aliases.model_constants import STARTUP_CLASS from wlsdeploy.aliases.wlst_modes import WlstModes @@ -97,6 +100,8 @@ def _add_resources(self, location): common_deployer.add_system_components(self._resources, location) common_deployer.add_ohs_components(self._resources, location) + self._add_managed_folders(location) + def _add_startup_classes(self, location): """ Add startup class elements at the specified location. @@ -112,3 +117,17 @@ def _add_shutdown_classes(self, location): """ shutdown_nodes = dictionary_utils.get_dictionary_element(self._resources, SHUTDOWN_CLASS) self._add_named_elements(SHUTDOWN_CLASS, shutdown_nodes, location) + + def _add_managed_folders(self, location): + """ + Add managed folder elements at the specified location. + :param location: the location to deploy elements + """ + template_nodes = dictionary_utils.get_dictionary_element(self._resources, MANAGED_EXECUTOR_SERVICE_TEMPLATE) + self._add_named_elements(MANAGED_EXECUTOR_SERVICE_TEMPLATE, template_nodes, location) + + template_nodes = dictionary_utils.get_dictionary_element(self._resources, MANAGED_SCHEDULED_EXECUTOR_SERVICE_TEMPLATE) + self._add_named_elements(MANAGED_SCHEDULED_EXECUTOR_SERVICE_TEMPLATE, template_nodes, location) + + template_nodes = dictionary_utils.get_dictionary_element(self._resources, MANAGED_THREAD_FACTORY_TEMPLATE) + self._add_named_elements(MANAGED_THREAD_FACTORY_TEMPLATE, template_nodes, location) diff --git a/core/src/main/python/wlsdeploy/tool/discover/global_resources_discoverer.py b/core/src/main/python/wlsdeploy/tool/discover/global_resources_discoverer.py index 67dfc59936..ae418d402e 100644 --- a/core/src/main/python/wlsdeploy/tool/discover/global_resources_discoverer.py +++ b/core/src/main/python/wlsdeploy/tool/discover/global_resources_discoverer.py @@ -67,6 +67,10 @@ def discover(self): self.discover_domain_single_mbean(model_constants.SNMP_AGENT, self._dictionary) self.discover_domain_named_mbeans(model_constants.SNMP_AGENT_DEPLOYMENT, self._dictionary) + self.discover_domain_named_mbeans(model_constants.MANAGED_EXECUTOR_SERVICE_TEMPLATE, self._dictionary) + self.discover_domain_named_mbeans(model_constants.MANAGED_SCHEDULED_EXECUTOR_SERVICE_TEMPLATE, self._dictionary) + self.discover_domain_named_mbeans(model_constants.MANAGED_THREAD_FACTORY_TEMPLATE, self._dictionary) + _logger.exiting(class_name=_class_name, method_name=_method_name) return self._dictionary diff --git a/core/src/main/python/wlsdeploy/tool/discover/topology_discoverer.py b/core/src/main/python/wlsdeploy/tool/discover/topology_discoverer.py index 0108176bb1..a08115f5c0 100644 --- a/core/src/main/python/wlsdeploy/tool/discover/topology_discoverer.py +++ b/core/src/main/python/wlsdeploy/tool/discover/topology_discoverer.py @@ -143,15 +143,6 @@ def discover(self): model_folder_name, folder_result = self._get_xml_registries() discoverer.add_to_model_if_not_empty(self._dictionary, model_folder_name, folder_result) - model_folder_name, folder_result = self.get_managed_executor_template() - discoverer.add_to_model_if_not_empty(self._dictionary, model_folder_name, folder_result) - - model_folder_name, folder_result = self.get_managed_thread_factory_template() - discoverer.add_to_model_if_not_empty(self._dictionary, model_folder_name, folder_result) - - model_folder_name, folder_result = self.get_managed_scheduled_executor_service() - discoverer.add_to_model_if_not_empty(self._dictionary, model_folder_name, folder_result) - model_folder_name, folder_result = self._get_ws_securities() discoverer.add_to_model_if_not_empty(self._dictionary, model_folder_name, folder_result) @@ -711,96 +702,6 @@ def _get_xml_registries(self): _logger.exiting(class_name=_class_name, method_name=_method_name, result=model_top_folder_name) return model_top_folder_name, result - def get_managed_executor_template(self): - """ - Discover the domain managed executor template - :return: model name for the folder: dictionary containing the discovered managed executor template - """ - _method_name = 'get_managed_executor_template' - _logger.entering(class_name=_class_name, method_name=_method_name) - model_top_folder_name = model_constants.MANAGED_EXECUTOR_SERVICE_TEMPLATE - result = OrderedDict() - location = LocationContext(self._base_location) - location.append_location(model_top_folder_name) - templates = self._find_names_in_folder(location) - if templates is not None: - _logger.info('WLSDPLY-06651', len(templates), class_name=_class_name, method_name=_method_name) - typedef = self._model_context.get_domain_typedef() - name_token = self._aliases.get_name_token(location) - for template in templates: - if typedef.is_filtered(location, template): - _logger.info('WLSDPLY-06667', typedef.get_domain_type(), template, class_name=_class_name, - method_name=_method_name) - else: - _logger.info('WLSDPLY-06652', template, class_name=_class_name, method_name=_method_name) - location.add_name_token(name_token, template) - result[template] = OrderedDict() - self._populate_model_parameters(result[template], location) - location.remove_name_token(name_token) - - _logger.exiting(class_name=_class_name, method_name=_method_name, result=model_top_folder_name) - return model_top_folder_name, result - - - def get_managed_scheduled_executor_service(self): - """ - Discover the domain managed scheduled executor service - :return: model name for the folder: dictionary containing the discovered managed scheduled executor - """ - _method_name = 'get_managed_scheduled_executor_service' - _logger.entering(class_name=_class_name, method_name=_method_name) - model_top_folder_name = model_constants.MANAGED_SCHEDULED_EXECUTOR_SERVICE - result = OrderedDict() - location = LocationContext(self._base_location) - location.append_location(model_top_folder_name) - services = self._find_names_in_folder(location) - if services is not None: - _logger.info('WLSDPLY-06653', len(services), class_name=_class_name, method_name=_method_name) - typedef = self._model_context.get_domain_typedef() - name_token = self._aliases.get_name_token(location) - for service in services: - if typedef.is_filtered(location, service): - _logger.info('WLSDPLY-06668', typedef.get_domain_type(), service, class_name=_class_name, - method_name=_method_name) - else: - _logger.info('WLSDPLY-06654', service, class_name=_class_name, method_name=_method_name) - location.add_name_token(name_token, service) - result[service] = OrderedDict() - self._populate_model_parameters(result[service], location) - location.remove_name_token(name_token) - - _logger.exiting(class_name=_class_name, method_name=_method_name, result=model_top_folder_name) - return model_top_folder_name, result - - def get_managed_thread_factory_template(self): - """ - Discover the domain managed thread factory template - :return: model name for the folder: dictionary containing the discovered managed thread factory templates """ - _method_name = 'get_managed_thread_factory_template' - _logger.entering(class_name=_class_name, method_name=_method_name) - model_top_folder_name = model_constants.MANAGED_SCHEDULED_EXECUTOR_SERVICE - result = OrderedDict() - location = LocationContext(self._base_location) - location.append_location(model_top_folder_name) - factories = self._find_names_in_folder(location) - if factories is not None: - _logger.info('WLSDPLY-06655', len(factories), class_name=_class_name, method_name=_method_name) - typedef = self._model_context.get_domain_typedef() - name_token = self._aliases.get_name_token(location) - for factory in factories: - if typedef.is_filtered(location, factory): - _logger.info('WLSDPLY-06669', typedef.get_domain_type(), factory, class_name=_class_name, - method_name=_method_name) - else: - _logger.info('WLSDPLY-06656', factory, class_name=_class_name, method_name=_method_name) - location.add_name_token(name_token, factory) - result[factory] = OrderedDict() - self._populate_model_parameters(result[factory], location) - location.remove_name_token(name_token) - - _logger.exiting(class_name=_class_name, method_name=_method_name, result=model_top_folder_name) - return model_top_folder_name, result - def _get_ws_securities(self): """ Discover the Webservice Security configuration for the domain diff --git a/core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/ManagedExecutorServiceTemplate.json b/core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/ManagedExecutorServiceTemplate.json index c4373feecd..f1ecadcdc6 100644 --- a/core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/ManagedExecutorServiceTemplate.json +++ b/core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/ManagedExecutorServiceTemplate.json @@ -1,5 +1,5 @@ { - "copyright": "Copyright (c) 2022, Oracle Corporation and/or its affiliates.", + "copyright": "Copyright (c) 2022, 2025, Oracle and/or its affiliates.", "license": "Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl", "wlst_type": "ManagedExecutorServiceTemplate${:s}", "child_folders_type": "multiple", @@ -7,6 +7,7 @@ "short_name": "ManagedESTemplate", "folders": {}, "attributes": { + "DeploymentOrder": [ {"version": "[12.2.1,)", "wlst_mode": "both", "wlst_name": "DeploymentOrder", "wlst_path": "WP001", "default_value": 1000, "wlst_type": "integer"} ], "DispatchPolicy": [ {"version": "[12.2.1,)", "wlst_mode": "both", "wlst_name": "DispatchPolicy", "wlst_path": "WP001", "default_value": "", "wlst_type": "string"} ], "LongRunningPriority": [ {"version": "[12.2.1,)", "wlst_mode": "both", "wlst_name": "LongRunningPriority", "wlst_path": "WP001", "default_value": 5, "wlst_type": "integer"} ], "MaxConcurrentLongRunningRequests": [ {"version": "[12.2.1,)", "wlst_mode": "both", "wlst_name": "MaxConcurrentLongRunningRequests", "wlst_path": "WP001", "default_value": 10, "wlst_type": "integer"} ], diff --git a/core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/ManagedScheduledExecutorService.json b/core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/ManagedScheduledExecutorServiceTemplate.json similarity index 87% rename from core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/ManagedScheduledExecutorService.json rename to core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/ManagedScheduledExecutorServiceTemplate.json index 12c1dd7bd3..2c67af7d9b 100644 --- a/core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/ManagedScheduledExecutorService.json +++ b/core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/ManagedScheduledExecutorServiceTemplate.json @@ -1,5 +1,5 @@ { - "copyright": "Copyright (c) 2022, Oracle Corporation and/or its affiliates.", + "copyright": "Copyright (c) 2022, 2025, Oracle and/or its affiliates.", "license": "Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl", "wlst_type": "ManagedScheduledExecutorServiceTemplate${:s}", "child_folders_type": "multiple", @@ -7,6 +7,7 @@ "short_name": "ManagedSchedESTemplate", "folders": {}, "attributes": { + "DeploymentOrder": [ {"version": "[12.2.1,)", "wlst_mode": "both", "wlst_name": "DeploymentOrder", "wlst_path": "WP001", "default_value": 1000, "wlst_type": "integer"} ], "DispatchPolicy": [ {"version": "[12.2.1,)", "wlst_mode": "both", "wlst_name": "DispatchPolicy", "wlst_path": "WP001", "default_value": "", "wlst_type": "string"} ], "LongRunningPriority": [ {"version": "[12.2.1,)", "wlst_mode": "both", "wlst_name": "LongRunningPriority", "wlst_path": "WP001", "default_value": 5, "wlst_type": "integer"} ], "MaxConcurrentLongRunningRequests": [ {"version": "[12.2.1,)", "wlst_mode": "both", "wlst_name": "MaxConcurrentLongRunningRequests", "wlst_path": "WP001", "default_value": 10, "wlst_type": "integer"} ], diff --git a/core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/ManagedThreadFactoryTemplate.json b/core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/ManagedThreadFactoryTemplate.json index 19c77ec44c..d3bb73bef1 100644 --- a/core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/ManagedThreadFactoryTemplate.json +++ b/core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/ManagedThreadFactoryTemplate.json @@ -1,5 +1,5 @@ { - "copyright": "Copyright (c) 2022, Oracle Corporation and/or its affiliates.", + "copyright": "Copyright (c) 2022, 2025, Oracle and/or its affiliates.", "license": "Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl", "wlst_type": "ManagedThreadFactoryTemplate${:s}", "child_folders_type": "multiple", @@ -7,6 +7,7 @@ "short_name": "ManagedThreadFactTemplate", "folders": {}, "attributes": { + "DeploymentOrder": [ {"version": "[12.2.1,)", "wlst_mode": "both", "wlst_name": "DeploymentOrder", "wlst_path": "WP001", "default_value": 1000, "wlst_type": "integer"} ], "MaxConcurrentNewThreads": [ {"version": "[12.2.1,)", "wlst_mode": "both", "wlst_name": "MaxConcurrentNewThreads", "wlst_path": "WP001", "default_value": 10, "wlst_type": "integer"} ], "Notes": [ {"version": "[12.2.1,)", "wlst_mode": "both", "wlst_name": "Notes", "wlst_path": "WP001", "default_value": null, "wlst_type": "string"} ], "Priority": [ {"version": "[12.2.1,)", "wlst_mode": "both", "wlst_name": "Priority", "wlst_path": "WP001", "default_value": 5, "wlst_type": "integer"} ],