3
3
4
4
from wlsdeploy .aliases .aliases import Aliases
5
5
from wlsdeploy .aliases .location_context import LocationContext
6
+ from wlsdeploy .aliases .model_constants import APP_DEPLOYMENTS
6
7
from wlsdeploy .aliases .model_constants import DOMAIN_INFO
7
8
from wlsdeploy .aliases .model_constants import RESOURCES
8
9
from wlsdeploy .aliases .model_constants import TOPOLOGY
@@ -21,45 +22,29 @@ def __init__(self, model_context, wlst_mode, exception_type):
21
22
self ._logger = PlatformLogger ('wlsdeploy.model_traverse' )
22
23
23
24
def traverse_model (self , root_dict ):
24
- section_names = [DOMAIN_INFO , TOPOLOGY , RESOURCES ]
25
+ section_names = [DOMAIN_INFO , TOPOLOGY , RESOURCES , APP_DEPLOYMENTS ]
25
26
for section_name in section_names :
26
- self .traverse_section (section_name , root_dict ,
27
- self ._aliases .get_model_section_top_level_folder_names (section_name ))
27
+ self .traverse_section (root_dict , section_name )
28
28
29
- def traverse_section (self , model_section_key , model_dict , valid_section_folders ):
30
- if model_section_key not in model_dict .keys ():
29
+ def traverse_section (self , model_dict , section_name ):
30
+ if section_name not in model_dict .keys ():
31
31
return
32
32
33
33
# only specific top-level sections have attributes
34
- attribute_location = self ._aliases .get_model_section_attribute_location (model_section_key )
35
- valid_attr_infos = []
36
-
34
+ valid_attribute_names = []
35
+ attribute_location = self ._aliases .get_model_section_attribute_location (section_name )
37
36
if attribute_location is not None :
38
- valid_attr_infos = self ._aliases .get_model_attribute_names_and_types (attribute_location )
39
-
40
- model_section_dict = model_dict [model_section_key ]
41
- # use items(), not iteritems(), to avoid ConcurrentModificationException if dict is modified
42
- for section_dict_key , section_dict_value in model_section_dict .items ():
43
- # section_dict_key is the name of a folder or attribute in the section.
44
-
45
- if section_dict_key in valid_attr_infos :
46
- # section_dict_key is the name of an attribute in the section
47
- self .traverse_attribute (model_section_dict , section_dict_key , attribute_location )
37
+ valid_attribute_names = self ._aliases .get_model_attribute_names_and_types (attribute_location )
48
38
49
- elif section_dict_key in valid_section_folders :
50
- # section_dict_key is a folder under the model section
51
-
52
- # Append section_dict_key to location context
53
- model_location = LocationContext ()
54
- model_location .append_location (section_dict_key )
55
-
56
- # Call self.traverse_folder() passing in section_dict_value as the model_node to process
57
- self .traverse_folder (section_dict_value , model_location )
39
+ model_location = LocationContext ()
40
+ model_section_dict = model_dict [section_name ]
41
+ valid_folder_names = self ._aliases .get_model_section_top_level_folder_names (section_name )
42
+ self .traverse_node_elements (model_section_dict , model_location , valid_folder_names , valid_attribute_names )
58
43
59
44
def traverse_folder (self , model_node , model_location ):
60
45
"""
61
46
Traverse a folder that may have named sub-folders (such as Server), artificial named sub-folders (such
62
- as a security provider type), or its own sub-folders and attributes (such as .
47
+ as a security provider type), or its own sub-folders and attributes (such as JTA) .
63
48
"""
64
49
65
50
# avoid checking folder type if is_artificial_type_folder
@@ -86,19 +71,22 @@ def traverse_folder(self, model_node, model_location):
86
71
self .traverse_node (model_node , model_location )
87
72
88
73
def traverse_node (self , model_node , model_location ):
74
+ valid_folder_names = self ._aliases .get_model_subfolder_names (model_location )
75
+ valid_attribute_names = self ._aliases .get_model_attribute_names (model_location )
76
+ self .traverse_node_elements (model_node , model_location , valid_folder_names , valid_attribute_names )
77
+
78
+ def traverse_node_elements (self , model_node , model_location , valid_folder_names , valid_attribute_names ):
89
79
"""
90
80
Traverse a node that contains only attributes, non-named sub-folders, and artificial type folders.
91
81
"""
92
- valid_folder_keys = self ._aliases .get_model_subfolder_names (model_location )
93
- valid_attr_infos = self ._aliases .get_model_attribute_names_and_types (model_location )
94
82
95
83
# use items(), not iteritems(), to avoid ConcurrentModificationException if node is modified
96
84
for key , value in model_node .items ():
97
- if key in valid_folder_keys :
85
+ if key in valid_folder_names :
98
86
new_location = LocationContext (model_location ).append_location (key )
99
87
self .traverse_folder (value , new_location )
100
88
101
- elif key in valid_attr_infos :
89
+ elif key in valid_attribute_names :
102
90
self .traverse_attribute (model_node , key , model_location )
103
91
104
92
else :
0 commit comments