Skip to content

Commit

Permalink
Merge branch 'managed-folders' into 'main'
Browse files Browse the repository at this point in the history
Discover and deploy managed MBean folders in resources model section

See merge request weblogic-cloud/weblogic-deploy-tooling!1776
  • Loading branch information
robertpatrick committed Jan 27, 2025
2 parents 4245e90 + 4facb50 commit aaa315c
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 105 deletions.
8 changes: 7 additions & 1 deletion core/src/main/python/wlsdeploy/aliases/alias_entries.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/python/wlsdeploy/aliases/model_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
21 changes: 20 additions & 1 deletion core/src/main/python/wlsdeploy/tool/deploy/resources_deployer.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"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",
"version": "[12.2.1,)",
"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"} ],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"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",
"version": "[12.2.1,)",
"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"} ],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"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",
"version": "[12.2.1,)",
"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"} ],
Expand Down

0 comments on commit aaa315c

Please sign in to comment.