Skip to content

Commit 1bec63f

Browse files
Merge pull request #224 from oracle/jira-wdt-9-create-domain-cluster-datasource
JIRA WDT-9 Create JDBC placeholders for use in cluster create and update
2 parents 881c643 + 3745f4b commit 1bec63f

File tree

5 files changed

+38
-17
lines changed

5 files changed

+38
-17
lines changed

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

+7-16
Original file line numberDiff line numberDiff line change
@@ -557,28 +557,18 @@ def __create_clusters_and_servers(self, location):
557557
_method_name = '__create_clusters_and_servers'
558558

559559
self.logger.entering(str(location), class_name=self.__class_name, method_name=_method_name)
560+
560561
#
561562
# In order for source domain provisioning to work with dynamic clusters, we have to provision
562563
# the ServerTemplates. There is a cyclical dependency between Server Template and Clusters so we
563564
# need for the ServerTemplates to exist before create clusters. Once the clusters are provisioned,
564565
# then we can fully populate the ServerTemplates.
565566
#
566-
server_template_nodes = dictionary_utils.get_dictionary_element(self._topology, SERVER_TEMPLATE)
567-
if len(server_template_nodes) > 0 and self._is_type_valid(location, SERVER_TEMPLATE):
568-
st_location = LocationContext(location).append_location(SERVER_TEMPLATE)
569-
st_mbean_type = self.alias_helper.get_wlst_mbean_type(st_location)
570-
st_create_path = self.alias_helper.get_wlst_create_path(st_location)
571-
self.wlst_helper.cd(st_create_path)
572-
573-
st_token_name = self.alias_helper.get_name_token(st_location)
574-
for server_template_name in server_template_nodes:
575-
st_name = self.wlst_helper.get_quoted_name_for_wlst(server_template_name)
576-
if st_token_name is not None:
577-
st_location.add_name_token(st_token_name, st_name)
578-
579-
st_mbean_name = self.alias_helper.get_wlst_mbean_name(st_location)
580-
self.logger.info('WLSDPLY-12220', SERVER_TEMPLATE, st_mbean_name)
581-
self.wlst_helper.create(st_mbean_name, st_mbean_type)
567+
self.topology_helper.create_placeholder_server_templates(self._topology)
568+
569+
# create placeholders for JDBC resources that may be referenced in cluster definition.
570+
resources_dict = self.model.get_model_resources()
571+
self.topology_helper.create_placeholder_jdbc_resources(resources_dict)
582572

583573
cluster_nodes = dictionary_utils.get_dictionary_element(self._topology, CLUSTER)
584574
if len(cluster_nodes) > 0:
@@ -587,6 +577,7 @@ def __create_clusters_and_servers(self, location):
587577
#
588578
# Now, fully populate the ServerTemplates, if any.
589579
#
580+
server_template_nodes = dictionary_utils.get_dictionary_element(self._topology, SERVER_TEMPLATE)
590581
if len(server_template_nodes) > 0:
591582
self._create_named_mbeans(SERVER_TEMPLATE, server_template_nodes, location, log_created=True)
592583

core/src/main/python/wlsdeploy/tool/deploy/topology_updater.py

+3
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ def update(self):
8181
# avoid circular references between clusters and server templates
8282
self._topology_helper.create_placeholder_server_templates(self._topology)
8383

84+
# create placeholders for JDBC resources that may be referenced in cluster definition.
85+
self._topology_helper.create_placeholder_jdbc_resources(self._resources)
86+
8487
self._process_section(self._topology, folder_list, CLUSTER, location)
8588
self._process_section(self._topology, folder_list, SERVER_TEMPLATE, location)
8689
self._process_section(self._topology, folder_list, SERVER, location)

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

+26
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from wlsdeploy.aliases.location_context import LocationContext
1010
from wlsdeploy.aliases.model_constants import CLUSTER
1111
from wlsdeploy.aliases.model_constants import COHERENCE_CLUSTER_SYSTEM_RESOURCE
12+
from wlsdeploy.aliases.model_constants import JDBC_SYSTEM_RESOURCE
1213
from wlsdeploy.aliases.model_constants import SERVER
1314
from wlsdeploy.aliases.model_constants import SERVER_TEMPLATE
1415
from wlsdeploy.tool.util.alias_helper import AliasHelper
@@ -87,3 +88,28 @@ def create_placeholder_server_templates(self, topology):
8788
deployer_utils.create_and_cd(template_location, existing_names, self.alias_helper)
8889

8990
self.wlst_helper.cd(original_location)
91+
92+
def create_placeholder_jdbc_resources(self, resources):
93+
"""
94+
Create a placeholder JDBC resource for each name in the resources section.
95+
This is necessary because cluster attributes may reference JDBC resources.
96+
:param resources: the resource model nodes
97+
"""
98+
_method_name = 'create_placeholder_jdbc_resources'
99+
original_location = self.wlst_helper.get_pwd()
100+
resource_location = LocationContext().append_location(JDBC_SYSTEM_RESOURCE)
101+
102+
if self.alias_helper.get_wlst_mbean_type(resource_location) is not None:
103+
existing_names = deployer_utils.get_existing_object_list(resource_location, self.alias_helper)
104+
105+
jdbc_nodes = dictionary_utils.get_dictionary_element(resources, JDBC_SYSTEM_RESOURCE)
106+
for jdbc_name in jdbc_nodes:
107+
if jdbc_name not in existing_names:
108+
self.logger.info('WLSDPLY-19401', jdbc_name, class_name=self.__class_name,
109+
method_name=_method_name)
110+
111+
jdbc_token = self.alias_helper.get_name_token(resource_location)
112+
resource_location.add_name_token(jdbc_token, jdbc_name)
113+
deployer_utils.create_and_cd(resource_location, existing_names, self.alias_helper)
114+
115+
self.wlst_helper.cd(original_location)

core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/Cluster.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@
169169
"ClusterType": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "ClusterType", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "restart_required": "true" } ],
170170
"CoherenceClusterSystemResource": [ {"version": "[12.1.2,)", "wlst_mode": "both", "wlst_name": "CoherenceClusterSystemResource", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "set_method": "${:MBEAN.set_coherence_cluster_mbean}", "set_mbean_type": "${:weblogic.management.configuration.CoherenceClusterSystemResourceMBean}", "restart_required": "true" } ],
171171
"ConcurrentSingletonActivationEnabled": [ {"version": "[12.2.1.3,)", "wlst_mode": "both", "wlst_name": "ConcurrentSingletonActivationEnabled", "wlst_path": "WP001", "value": {"default": "false" }, "wlst_type": "boolean", "restart_required": "true" } ],
172-
"ConsensusParticipants": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "ConsensusParticipants", "wlst_path": "WP001", "value": {"default": 0 }, "wlst_type": "integer", "get_method": "${LSA:GET}", "get_mbean_type": "${:JDBCSystemResourceMBean}", "set_method": "${:MBEAN.set_data_source_mbean}", "set_mbean_type": "${:weblogic.management.configuration.JDBCSystemResourceMBean}", "restart_required": true } ],
172+
"ConsensusParticipants": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "ConsensusParticipants", "wlst_path": "WP001", "value": {"default": 0 }, "wlst_type": "integer" } ],
173173
"DataSourceForAutomaticMigration": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "DataSourceForAutomaticMigration", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "set_method": "${:MBEAN.set_data_source_mbean}", "set_mbean_type": "${:weblogic.management.configuration.JDBCSystemResourceMBean}", "restart_required": "true" } ],
174174
"DataSourceForJobScheduler": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "DataSourceForJobScheduler", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "set_method": "${:MBEAN.set_data_source_mbean}", "set_mbean_type": "${:weblogic.management.configuration.JDBCSystemResourceMBean}" } ],
175175
"DataSourceForSessionPersistence": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "DataSourceForSessionPersistence", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "set_method": "${:MBEAN.set_data_source_mbean}", "set_mbean_type": "${:weblogic.management.configuration.JDBCSystemResourceMBean}", "restart_required": "true" } ],

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

+1
Original file line numberDiff line numberDiff line change
@@ -1159,6 +1159,7 @@ WLSDPLY-19307=Unable to extract classpath libraries from archive file {0} to dom
11591159

11601160
# wlsdeploy/tool/util/topology_helper.py
11611161
WLSDPLY-19400=Creating placeholder for server template {0}
1162+
WLSDPLY-19401=Creating placeholder for JDBC resource {0}
11621163

11631164
# wlsdeploy/tool/util/variable_injector.py
11641165
WLSDPLY-19500=Model variable injector values loaded from location {0}

0 commit comments

Comments
 (0)