|
12 | 12 | from wlsdeploy.exception import exception_helper |
13 | 13 | from wlsdeploy.json.json_translator import JsonToPython |
14 | 14 | from wlsdeploy.logging.platform_logger import PlatformLogger |
| 15 | +from wlsdeploy.tool.util.targeting_types import TargetingType |
15 | 16 | from wlsdeploy.util.cla_utils import CommandLineArgUtil |
16 | 17 | from wlsdeploy.util.weblogic_helper import WebLogicHelper |
17 | 18 |
|
@@ -70,6 +71,8 @@ def __init__(self, program_name, domain_type): |
70 | 71 | self._model_context = None |
71 | 72 | self._version_typedef_name = None |
72 | 73 |
|
| 74 | + self._targeting_type = self._resolve_targeting_type() |
| 75 | + |
73 | 76 | if 'system-elements' in self._domain_typedefs_dict: |
74 | 77 | self._system_elements = self._domain_typedefs_dict['system-elements'] |
75 | 78 | else: |
@@ -185,6 +188,13 @@ def required_rcu(self): |
185 | 188 | # resolution for create.py argument processing. |
186 | 189 | return 'rcuSchemas' in self._domain_typedef and len(self._domain_typedef['rcuSchemas']) > 0 |
187 | 190 |
|
| 191 | + def get_targeting(self): |
| 192 | + """ |
| 193 | + Get the targeting type for the domain, or None if not specified. |
| 194 | + :return: the TargetingType enum value for the domain, or None |
| 195 | + """ |
| 196 | + return self._targeting_type |
| 197 | + |
188 | 198 | def is_system_app(self, name): |
189 | 199 | """ |
190 | 200 | Determine if the specified name matches a WLS system application. |
@@ -409,3 +419,32 @@ def __match_version_typedef(self, versions_dict): |
409 | 419 | raise ex |
410 | 420 | self._logger.exiting(self.__class_name, _method_name, result) |
411 | 421 | return result |
| 422 | + |
| 423 | + def _resolve_targeting_type(self): |
| 424 | + """ |
| 425 | + Determine the targeting type based on the value in the definition. |
| 426 | + Check for problems or incompatibilities. |
| 427 | + :return: the matching TargetType enum value |
| 428 | + :raises: ClaException: if there are problems or incompatibilities |
| 429 | + """ |
| 430 | + _method_name = '_resolve_targeting_type' |
| 431 | + |
| 432 | + if 'targeting' not in self._domain_typedef: |
| 433 | + return None |
| 434 | + |
| 435 | + targeting_text = self._domain_typedef['targeting'] |
| 436 | + |
| 437 | + # there are no valid targeting types for version 12c and up |
| 438 | + if self.wls_helper.is_set_server_groups_supported(): |
| 439 | + ex = exception_helper.create_cla_exception('WLSDPLY-12311', targeting_text, self._domain_typedef_filename, |
| 440 | + self.wls_helper.get_weblogic_version()) |
| 441 | + self._logger.throwing(ex, class_name=self.__class_name, method_name=_method_name) |
| 442 | + raise ex |
| 443 | + |
| 444 | + # if specified, targeting must be one of the known types |
| 445 | + if targeting_text not in TargetingType: |
| 446 | + ex = exception_helper.create_cla_exception('WLSDPLY-12312', targeting_text, self._domain_typedef_filename) |
| 447 | + self._logger.throwing(ex, class_name=self.__class_name, method_name=_method_name) |
| 448 | + raise ex |
| 449 | + |
| 450 | + return TargetingType[targeting_text] |
0 commit comments