Skip to content

Commit 0420655

Browse files
committed
adding support for specifying the topology profile in the typedef files
1 parent 5556880 commit 0420655

File tree

6 files changed

+84
-1
lines changed

6 files changed

+84
-1
lines changed

core/src/main/python/wlsdeploy/tool/create/domain_creator.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
from wlsdeploy.tool.util.rcu_helper import RCUHelper
9191
from wlsdeploy.tool.util.target_helper import TargetHelper
9292
from wlsdeploy.tool.util.targeting_types import TargetingType
93+
from wlsdeploy.tool.util.topology_profiles import TopologyProfile
9394
from wlsdeploy.tool.util.topology_helper import TopologyHelper
9495
from wlsdeploy.util import dictionary_utils
9596
from wlsdeploy.util import model
@@ -508,6 +509,12 @@ def __create_base_domain_with_select_template(self, domain_home):
508509
_method_name = '__create_base_domain_with_select_template'
509510

510511
self.logger.entering(domain_home, class_name=self.__class_name, method_name=_method_name)
512+
513+
topology_profile = self._domain_typedef.get_topology_profile()
514+
if topology_profile in TopologyProfile:
515+
self.logger.info('WLSDPLY-12569', topology_profile, class_name=self.__class_name, method_name=_method_name)
516+
self.wlst_helper.set_topology_profile(topology_profile)
517+
511518
base_template = self._domain_typedef.get_base_template()
512519
self.logger.info('WLSDPLY-12210', base_template,
513520
class_name=self.__class_name, method_name=_method_name)

core/src/main/python/wlsdeploy/tool/create/domain_typedef.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from wlsdeploy.json.json_translator import JsonToPython
1414
from wlsdeploy.logging.platform_logger import PlatformLogger
1515
from wlsdeploy.tool.util.targeting_types import TargetingType
16+
from wlsdeploy.tool.util.topology_profiles import TopologyProfile
1617
from wlsdeploy.util import path_utils
1718
from wlsdeploy.util.cla_utils import CommandLineArgUtil
1819
from wlsdeploy.util.weblogic_helper import WebLogicHelper
@@ -81,6 +82,8 @@ def __init__(self, program_name, domain_type):
8182
else:
8283
self._system_elements = {}
8384

85+
self._topology_profile = self._resolve_topology_profile()
86+
8487
return
8588

8689
def set_model_context(self, model_context):
@@ -101,6 +104,13 @@ def get_domain_type(self):
101104
"""
102105
return self._domain_type
103106

107+
def get_topology_profile(self):
108+
"""
109+
Get the topology profile for the domain type, if any.
110+
:return: the topology profile or None if no topology profile is specified
111+
"""
112+
return self._topology_profile
113+
104114
def has_jrf_resources(self):
105115
"""
106116
Determine if the domain type has domain resources from either the JRF or Restricted JRF templates.
@@ -474,3 +484,31 @@ def _resolve_targeting_type(self):
474484
raise ex
475485

476486
return TargetingType[targeting_text]
487+
488+
def _resolve_topology_profile(self):
489+
"""
490+
Determine the topology profile based on the value in the typedef file.
491+
492+
:return: the matching topology profile enum value
493+
:raises: ClaException: if there are problems or incompatibilities
494+
"""
495+
_method_name = '_resolve_topology_profile'
496+
497+
if 'topologyProfile' not in self._domain_typedefs_dict:
498+
return None
499+
topology_profile = self._domain_typedefs_dict['topologyProfile'];
500+
501+
# there are no valid topology profiles for versions 12.1.x and below
502+
if not self.wls_helper.is_topology_profile_supported():
503+
ex = exception_helper.create_cla_exception('WLSDPLY-12314', topology_profile, self._domain_typedef_filename,
504+
self.wls_helper.get_weblogic_version())
505+
self._logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
506+
raise ex
507+
508+
# if specified, toppology profile must be one of the known types
509+
if topology_profile not in TopologyProfile:
510+
ex = exception_helper.create_cla_exception('WLSDPLY-12315', topology_profile, self._domain_typedef_filename)
511+
self._logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
512+
raise ex
513+
514+
return topology_profile
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
"""
2+
Copyright (c) 2022, Oracle Corporation and/or its affiliates.
3+
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
4+
"""
5+
from wlsdeploy.util.enum import Enum
6+
7+
TopologyProfile = Enum([
8+
'Compact',
9+
'Expanded'
10+
])

core/src/main/python/wlsdeploy/tool/util/wlst_helper.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,24 @@ def load_templates(self):
692692
raise pwe
693693
self.__logger.exiting(class_name=self.__class_name, method_name=_method_name)
694694

695+
def set_topology_profile(self, profile):
696+
"""
697+
Set the desired topology profile defined in the domain extension template.
698+
:param profile: the profile to use
699+
:raises: Exception for the specified tool type: if a WLST error occurs
700+
"""
701+
_method_name = 'set-topology_profile'
702+
703+
self.__logger.entering(profile, class_name=self.__class_name, method_name=_method_name)
704+
try:
705+
self.__load_global('setTopologyProfile')(profile)
706+
except offlineWLSTException, e:
707+
pwe = exception_helper.create_exception(self.__exception_type, 'WLSDPLY-00128', profile,
708+
e.getLocalizedMessage(), error=e)
709+
self.__logger.throwing(class_name=self.__class_name, method_name=_method_name, error=pwe)
710+
raise pwe
711+
self.__logger.exiting(class_name=self.__class_name, method_name=_method_name)
712+
695713
def read_domain(self, domain_home):
696714
"""
697715
Read the domain indicated by the domain_home name in offline mode.

core/src/main/python/wlsdeploy/util/weblogic_helper.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,13 @@ def is_dynamic_cluster_server_groups_supported(self):
117117
"""
118118
return self.is_weblogic_version_or_above('12.2.1.4')
119119

120+
def is_topology_profile_supported(self):
121+
"""
122+
Is topology profile supported in domain extension templates?
123+
:return: true if version is within the range supporting topology profiles, false otherwise
124+
"""
125+
return self.is_weblogic_version_or_above('12.2.1')
126+
120127
def get_jdbc_url_from_rcu_connect_string(self, rcu_connect_string):
121128
"""
122129
Get the JDBC URL from the RCU connect string.

core/src/main/resources/oracle/weblogic/deploy/messages/wlsdeploy_rb.properties

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ WLSDPLY-00124=Entering is_set({0}) method
110110
WLSDPLY-00125=is_set({0}) in {1} mode failed: {2}
111111
WLSDPLY-00126=Exiting is_set({0}) method
112112
WLSDPLY-00127=Unable to load the DomainRuntimeService from the WLST globals : {0}
113-
113+
WLSDPLY-00128=setTopologyProfile({0}) failed: {1}
114114

115115
###############################################################################
116116
# Util messages (1000 - 3999) #
@@ -1330,6 +1330,7 @@ WLSDPLY-12565=The archive file was not provided so there are no custom files to
13301330
WLSDPLY-12566=Installing {0} user custom files to domain home {1}
13311331
WLSDPLY-12567=The archive file {0} contains no user custom files to install
13321332
WLSDPLY-12568=Creating empty folder {0}. Folder contains no attributes or sub-folders.
1333+
WLSDPLY-12569=Setting the topology profile to {0}
13331334

13341335
# domain_typedef.py
13351336
WLSDPLY-12300={0} got the domain type {1} but the domain type definition file {2} was not valid: {3}
@@ -1348,6 +1349,8 @@ WLSDPLY-12310=Version {0} returned from the domain home
13481349
WLSDPLY-12311=Targeting type "{0}" in type definition file {1} is not allowed for WebLogic version {2}
13491350
WLSDPLY-12312=Targeting type "{0}" in type definition file {1} is not valid
13501351
WLSDPLY-12313=Domain type {0} is not supported for WebLogic version {1}
1352+
WLSDDPL-12314=Topology profile "{0}" is typedef file {1} is not allowed for WebLogic version {2}
1353+
WLSDPLY-12315=Topology profile "{0}" in type definition file {1} is not a known topology profile value
13511354

13521355
# create.py
13531356
WLSDPLY-12400={0} got the JAVA_HOME {1} from the environment variable but it was not a valid location: {2}

0 commit comments

Comments
 (0)