|
9 | 9 | from wlsdeploy.aliases.location_context import LocationContext
|
10 | 10 | from wlsdeploy.exception import exception_helper
|
11 | 11 | from wlsdeploy.tool.create.creator import Creator
|
| 12 | +from wlsdeploy.tool.deploy import deployer_utils |
12 | 13 | from wlsdeploy.tool.deploy import model_deployer
|
13 | 14 | from wlsdeploy.tool.util.archive_helper import ArchiveHelper
|
14 | 15 | from wlsdeploy.util import dictionary_utils
|
|
26 | 27 | from wlsdeploy.aliases.model_constants import AUTHORIZER
|
27 | 28 | from wlsdeploy.aliases.model_constants import CERT_PATH_PROVIDER
|
28 | 29 | from wlsdeploy.aliases.model_constants import CLUSTER
|
| 30 | +from wlsdeploy.aliases.model_constants import COHERENCE_CLUSTER_SYSTEM_RESOURCE |
29 | 31 | from wlsdeploy.aliases.model_constants import CREDENTIAL_MAPPER
|
30 | 32 | from wlsdeploy.aliases.model_constants import DEFAULT_ADJUDICATOR_NAME
|
31 | 33 | from wlsdeploy.aliases.model_constants import DEFAULT_ADJUDICATOR_TYPE
|
@@ -95,6 +97,8 @@ def __init__(self, model_dictionary, model_context, aliases):
|
95 | 97 | _method_name = '__init__'
|
96 | 98 | Creator.__init__(self, model_dictionary, model_context, aliases)
|
97 | 99 |
|
| 100 | + self._coherence_cluster_elements = [CLUSTER, SERVER, SERVER_TEMPLATE] |
| 101 | + |
98 | 102 | # domainInfo section is required to get the admin password, everything else
|
99 | 103 | # is optional and will use the template defaults
|
100 | 104 | if model_helper.get_model_domain_info_key() not in model_dictionary:
|
@@ -158,6 +162,22 @@ def create(self):
|
158 | 162 | self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
|
159 | 163 | return
|
160 | 164 |
|
| 165 | + # Override |
| 166 | + def _create_named_mbeans(self, type_name, model_nodes, base_location, log_created=False): |
| 167 | + """ |
| 168 | + Override default behavior to create placeholders for referenced Coherence clusters. |
| 169 | + :param type_name: the model folder type |
| 170 | + :param model_nodes: the model dictionary of the specified model folder type |
| 171 | + :param base_location: the base location object to use to create the MBeans |
| 172 | + :param log_created: whether or not to log created at INFO level, by default it is logged at the FINE level |
| 173 | + :raises: CreateException: if an error occurs |
| 174 | + """ |
| 175 | + if type_name in self._coherence_cluster_elements: |
| 176 | + self._check_coherence_cluster_references(model_nodes, base_location) |
| 177 | + # continue with regular processing |
| 178 | + |
| 179 | + Creator._create_named_mbeans(self, type_name, model_nodes, base_location) |
| 180 | + |
161 | 181 | def __run_rcu(self):
|
162 | 182 | """
|
163 | 183 | The method that runs RCU to drop and then create the schemas.
|
@@ -1152,3 +1172,38 @@ def __fix_up_model_default_identity_asserter(self, base_location, model_name, mo
|
1152 | 1172 | default_value = self.alias_helper.get_model_attribute_default_value(location, ACTIVE_TYPE)
|
1153 | 1173 | subtype_dict[ACTIVE_TYPE] = default_value
|
1154 | 1174 | return
|
| 1175 | + |
| 1176 | + def _check_coherence_cluster_references(self, named_nodes, location): |
| 1177 | + """ |
| 1178 | + If a named element has the Coherence cluster system resource attribute, confirm that the resource exists. |
| 1179 | + If the resource does not exist, create a placeholder resource to allow assignment. |
| 1180 | + :param named_nodes: a dictionary containing the named model elements |
| 1181 | + :param location: the location of the cluster |
| 1182 | + :return: |
| 1183 | + """ |
| 1184 | + for name in named_nodes: |
| 1185 | + child_nodes = dictionary_utils.get_dictionary_element(named_nodes, name) |
| 1186 | + resource_name = dictionary_utils.get_element(child_nodes, COHERENCE_CLUSTER_SYSTEM_RESOURCE) |
| 1187 | + if resource_name is not None: |
| 1188 | + self._create_placeholder_coherence_cluster(resource_name) |
| 1189 | + |
| 1190 | + def _create_placeholder_coherence_cluster(self, cluster_name): |
| 1191 | + """ |
| 1192 | + Create a placeholder Coherence cluster system resource to be referenced from a topology element. |
| 1193 | + The new cluster will be created at the root domain level. |
| 1194 | + Clusters referenced from the model's resources section should not require placeholder entries. |
| 1195 | + :param cluster_name: the name of the Coherence cluster system resource to be added |
| 1196 | + """ |
| 1197 | + _method_name = '_create_placeholder_coherence_cluster' |
| 1198 | + original_location = self.wlst_helper.get_pwd() |
| 1199 | + cluster_location = LocationContext().append_location(COHERENCE_CLUSTER_SYSTEM_RESOURCE) |
| 1200 | + existing_names = deployer_utils.get_existing_object_list(cluster_location, self.alias_helper) |
| 1201 | + |
| 1202 | + if cluster_name not in existing_names: |
| 1203 | + self.logger.info('WLSDPLY-12230', cluster_name, class_name=self.__class_name, method_name=_method_name) |
| 1204 | + |
| 1205 | + cluster_token = self.alias_helper.get_name_token(cluster_location) |
| 1206 | + cluster_location.add_name_token(cluster_token, cluster_name) |
| 1207 | + deployer_utils.create_and_cd(cluster_location, existing_names, self.alias_helper) |
| 1208 | + |
| 1209 | + self.wlst_helper.cd(original_location) |
0 commit comments