1414from wlsdeploy .aliases import password_utils
1515from wlsdeploy .aliases .alias_constants import ChildFoldersTypes
1616from wlsdeploy .aliases .location_context import LocationContext
17+ from wlsdeploy .aliases .model_constants import APPLICATION
18+ from wlsdeploy .aliases .model_constants import ODL_CONFIGURATION
19+ from wlsdeploy .aliases .model_constants import RESOURCE_MANAGER
1720from wlsdeploy .aliases .validation_codes import ValidationCodes
1821from wlsdeploy .aliases .wlst_modes import WlstModes
1922from wlsdeploy .exception import exception_helper
@@ -72,57 +75,6 @@ class AliasEntries(object):
7275 __category_modules_dir_name = 'oracle/weblogic/deploy/aliases/category_modules/'
7376 __domain_category = 'Domain'
7477
75- __model_categories_map = {
76- 'AdminConsole' : 'AdminConsole' ,
77- 'Application' : 'AppDeployment' ,
78- 'Cluster' : 'Cluster' ,
79- 'CoherenceClusterSystemResource' : 'CoherenceClusterSystemResource' ,
80- 'Domain' : 'Domain' ,
81- 'EmbeddedLDAP' : 'EmbeddedLDAP' ,
82- 'FileStore' : 'FileStore' ,
83- 'ForeignJNDIProvider' : 'ForeignJNDIProvider' ,
84- 'JDBCStore' : 'JDBCStore' ,
85- 'JDBCSystemResource' : 'JDBCSystemResource' ,
86- 'JMSBridgeDestination' : 'JMSBridgeDestination' ,
87- 'JMSServer' : 'JMSServer' ,
88- 'JMSSystemResource' : 'JMSSystemResource' ,
89- 'JMX' : 'JMX' ,
90- 'JTA' : 'JTA' ,
91- 'Library' : 'Library' ,
92- 'Log' : 'Log' ,
93- 'LogFilter' : 'LogFilter' ,
94- 'Machine' : 'Machine' ,
95- 'MailSession' : 'MailSession' ,
96- 'MessagingBridge' : 'MessagingBridge' ,
97- 'MigratableTarget' : 'MigratableTarget' ,
98- 'NMProperties' : 'NMProperties' ,
99- 'Partition' : 'Partition' ,
100- 'PartitionWorkManager' : 'PartitionWorkManager' ,
101- 'PathService' : 'PathService' ,
102- 'ResourceGroup' : 'ResourceGroup' ,
103- 'ResourceGroupTemplate' : 'ResourceGroupTemplate' ,
104- 'ResourceManagement' : 'ResourceManagement' ,
105- 'ResourceManager' : 'ResourceManager' ,
106- 'RestfulManagementServices' : 'RestfulManagementServices' ,
107- 'SAFAgent' : 'SAFAgent' ,
108- 'Security' : 'Security' ,
109- 'SecurityConfiguration' : 'SecurityConfiguration' ,
110- 'SelfTuning' : 'SelfTuning' ,
111- 'Server' : 'Server' ,
112- 'ServerTemplate' : 'ServerTemplate' ,
113- 'ShutdownClass' : 'ShutdownClass' ,
114- 'SingletonService' : 'SingletonService' ,
115- 'StartupClass' : 'StartupClass' ,
116- 'UnixMachine' : 'UnixMachine' ,
117- 'VirtualHost' : 'VirtualHost' ,
118- 'VirtualTarget' : 'VirtualTarget' ,
119- 'WebAppContainer' : 'WebAppContainer' ,
120- 'WLDFSystemResource' : 'WLDFSystemResource' ,
121- 'WSReliableDeliveryPolicy' : 'WSReliableDeliveryPolicy' ,
122- 'XMLEntityCache' : 'XMLEntityCache' ,
123- 'XMLRegistry' : 'XMLRegistry'
124- }
125-
12678 __topology_top_level_folders = [
12779 'AdminConsole' ,
12880 'Cluster' ,
@@ -158,6 +110,7 @@ class AliasEntries(object):
158110 'JMSSystemResource' ,
159111 'MailSession' ,
160112 'MessagingBridge' ,
113+ ODL_CONFIGURATION ,
161114 'Partition' ,
162115 'PartitionWorkManager' ,
163116 'PathService' ,
@@ -178,6 +131,8 @@ class AliasEntries(object):
178131 'Library'
179132 ]
180133
134+ __all_model_categories = []
135+
181136 __domain_info_attributes_and_types = {
182137 'AdminUserName' : 'string' ,
183138 'AdminPassword' : 'password' ,
@@ -211,6 +166,11 @@ def __init__(self, wlst_mode=WlstModes.OFFLINE, wls_version=None):
211166 self ._wls_helper = WebLogicHelper (_logger , wls_version )
212167 self ._wls_version = wls_version
213168
169+ self .__all_model_categories .extend (self .__topology_top_level_folders )
170+ self .__all_model_categories .extend (self .__resources_top_level_folders )
171+ self .__all_model_categories .extend (self .__app_deployments_top_level_folders )
172+ self .__all_model_categories .append (RESOURCE_MANAGER )
173+
214174 return
215175
216176 def get_dictionary_for_location (self , location , resolve = True ):
@@ -241,7 +201,7 @@ def get_model_domain_subfolder_names(self):
241201 _method_name = 'get_model_domain_subfolder_names'
242202
243203 _logger .entering (class_name = _class_name , method_name = _method_name )
244- folder_list = list (self .__model_categories_map . keys () )
204+ folder_list = list (self .__all_model_categories )
245205 #
246206 # Remove all folders that do not appear at the WLST root level
247207 #
@@ -914,12 +874,24 @@ def _unit_test_only_get_category_map_files(self):
914874 :return: blob of stuff
915875 """
916876 result = {}
917- for key , value in self .__model_categories_map . iteritems () :
918- category_file_name = '%s.json' % value
877+ for key in self .__all_model_categories :
878+ category_file_name = '%s.json' % self . _get_category_file_prefix ( key )
919879 category_file_path = '%s%s' % (self .__category_modules_dir_name , category_file_name )
920880 result [key ] = category_file_path
921881 return result
922882
883+ def _get_category_file_prefix (self , category_name ):
884+ """
885+ Return the file prefix for the specified top-level category.
886+ The file prefix should match the category name exactly.
887+ File name for Application is different for some reason
888+ :param category_name: the name to be checked
889+ :return: the corressponding file name prefix
890+ """
891+ if category_name == APPLICATION :
892+ return 'AppDeployment'
893+ return category_name
894+
923895 def __get_dictionary_for_location (self , location , resolve_path_tokens = True ):
924896 """
925897 Get the dictionary for a location with or without path tokens resolved
@@ -941,7 +913,7 @@ def __get_dictionary_for_location(self, location, resolve_path_tokens=True):
941913 model_category_name = self .__domain_category
942914 else :
943915 model_category_name = location_folders [0 ]
944- if model_category_name not in self .__model_categories_map :
916+ if model_category_name not in self .__all_model_categories :
945917 ex = exception_helper .create_alias_exception ('WLSDPLY-08116' , model_category_name )
946918 _logger .throwing (ex , class_name = _class_name , method_name = _method_name )
947919 raise ex
@@ -993,7 +965,7 @@ def __load_category(self, model_category_name):
993965 _method_name = '__load_category'
994966
995967 _logger .entering (model_category_name , class_name = _class_name , method_name = _method_name )
996- model_category_file = self .__model_categories_map [ model_category_name ]
968+ model_category_file = self ._get_category_file_prefix ( model_category_name )
997969 raw_category_dict = self .__load_category_file (model_category_file )
998970 _logger .fine ('WLSDPLY-08118' , model_category_name , class_name = _class_name , method_name = _method_name )
999971
@@ -1083,8 +1055,8 @@ def __load_contains_categories(self, model_category_name, raw_model_dict, base_p
10831055
10841056 contained_folders = raw_model_dict [CONTAINS ]
10851057 for contained_folder in contained_folders :
1086- if contained_folder in self .__model_categories_map :
1087- folder_file = self .__model_categories_map [ contained_folder ]
1058+ if contained_folder in self .__all_model_categories :
1059+ folder_file = self ._get_category_file_prefix ( contained_folder )
10881060 else :
10891061 ex = exception_helper .create_alias_exception ('WLSDPLY-08122' , contained_folder , model_category_name )
10901062 _logger .throwing (ex , class_name = _class_name , method_name = _method_name )
0 commit comments