16
16
from wlsdeploy .exception import exception_helper
17
17
from wlsdeploy .exception .expection_types import ExceptionType
18
18
from wlsdeploy .logging .platform_logger import PlatformLogger
19
+ from wlsdeploy .tool .util .mbean_utils import MBeanUtils
19
20
from wlsdeploy .tool .util .alias_helper import AliasHelper
20
21
from wlsdeploy .tool .util .wlst_helper import WlstHelper
21
22
from wlsdeploy .util import path_utils
@@ -51,6 +52,7 @@ def __init__(self, model_context, base_location, wlst_mode, aliases=None):
51
52
self ._weblogic_helper = WebLogicHelper (_logger )
52
53
self ._wls_version = self ._weblogic_helper .get_actual_weblogic_version ()
53
54
self ._wlst_helper = WlstHelper (_logger , ExceptionType .DISCOVER )
55
+ self ._mbean_utils = MBeanUtils (self ._model_context , ExceptionType .DISCOVER )
54
56
55
57
# methods for use only by the subclasses
56
58
@@ -69,50 +71,69 @@ def _populate_model_parameters(self, dictionary, location):
69
71
if not self .wlst_cd (wlst_path , location ):
70
72
return
71
73
72
- wlst_params = self ._get_attributes_for_current_location (location )
73
- _logger .finest ('WLSDPLY-06102' , self ._wlst_helper .get_pwd (), wlst_params , class_name = _class_name ,
74
+ wlst_lsa_params = self ._get_attributes_for_current_location (location )
75
+ _logger .finest ('WLSDPLY-06102' , self ._wlst_helper .get_pwd (), wlst_lsa_params , class_name = _class_name ,
74
76
method_name = _method_name )
75
77
wlst_get_params = self ._get_required_attributes (location )
76
78
_logger .finest ('WLSDPLY-06103' , str (location ), wlst_get_params ,
77
79
class_name = _class_name , method_name = _method_name )
78
- attr_dict = OrderedDict ()
79
- if wlst_params :
80
- for wlst_param in wlst_params :
81
- if wlst_param in wlst_get_params :
82
- _logger .finest ('WLSDPLY-06104' , wlst_param , class_name = _class_name , method_name = _method_name )
83
- try :
84
- wlst_value = wlst_helper .get (wlst_param )
85
- except PyWLSTException , pe :
86
- _logger .warning ('WLSDPLY-06127' , wlst_param , wlst_path ,
87
- pe .getLocalizedMessage (), class_name = _class_name , method_name = _method_name )
80
+ if wlst_lsa_params is not None :
81
+ for wlst_lsa_param in wlst_lsa_params :
82
+ if wlst_lsa_param in wlst_get_params :
83
+ success , wlst_value = self ._get_attribute_value_with_get (wlst_lsa_param , wlst_path )
84
+ if not success :
88
85
continue
89
86
else :
90
- _logger .finer ('WLSDPLY-06131' , wlst_param , class_name = _class_name , method_name = _method_name )
91
- wlst_value = wlst_params [wlst_param ]
87
+ _logger .finer ('WLSDPLY-06131' , wlst_lsa_param , class_name = _class_name , method_name = _method_name )
88
+ wlst_value = wlst_lsa_params [wlst_lsa_param ]
89
+ self ._add_to_dictionary (dictionary , location , wlst_lsa_param , wlst_value , wlst_path )
92
90
93
- # if type(wlst_value) == str and len(wlst_value) == 0:
94
- # wlst_value = None
95
-
96
- _logger .finer ('WLSDPLY-06105' , wlst_param , wlst_value , wlst_path , class_name = _class_name ,
97
- method_name = _method_name )
98
- try :
99
- model_param , model_value = self ._aliases .get_model_attribute_name_and_value (location ,
100
- wlst_param ,
101
- wlst_value )
102
- except AliasException , de :
103
- _logger .info ('WLSDPLY-06106' , wlst_param , wlst_path , de .getLocalizedMessage (),
91
+ # These will come after the lsa / get params in the ordered dictionary
92
+ wlst_extra_params = self ._get_additional_parameters (location )
93
+ _logger .finest ('WLSDPLY-06149' , str (location ), wlst_extra_params ,
94
+ class_name = _class_name , method_name = _method_name )
95
+ if wlst_extra_params is not None :
96
+ for wlst_extra_param in wlst_extra_params :
97
+ if wlst_extra_param not in wlst_get_params :
98
+ _logger .info ('WLSDPLY-06148' , wlst_extra_param , str (location ),
104
99
class_name = _class_name , method_name = _method_name )
105
- continue
100
+ success , wlst_value = self ._get_attribute_value_with_get (wlst_extra_param , wlst_path )
101
+ if success :
102
+ self ._add_to_dictionary (dictionary , location , wlst_extra_param , wlst_value , wlst_path )
103
+
104
+ def _get_attribute_value_with_get (self , wlst_get_param , wlst_path ):
105
+ _method_name = '_get_attribute_value_with_get'
106
+ _logger .finest ('WLSDPLY-06104' , wlst_get_param , class_name = _class_name , method_name = _method_name )
107
+ success = False
108
+ wlst_value = None
109
+ try :
110
+ wlst_value = self ._wlst_helper .get (wlst_get_param )
111
+ success = True
112
+ except DiscoverException , pe :
113
+ _logger .warning ('WLSDPLY-06127' , wlst_get_param , wlst_path , pe .getLocalizedMessage (),
114
+ class_name = _class_name , method_name = _method_name )
115
+ return success , wlst_value
106
116
107
- attr_dict [model_param ] = wlst_value
108
- model_value = self ._check_attribute (model_param , model_value , location )
109
- if model_value is not None :
110
- _logger .finer ('WLSDPLY-06107' , model_param , model_value , class_name = _class_name ,
111
- method_name = _method_name )
112
- dictionary [model_param ] = model_value
113
- elif model_param is None :
114
- _logger .finest ('WLSDPLY-06108' , model_param , class_name = _class_name , method_name = _method_name )
115
- return attr_dict
117
+ def _add_to_dictionary (self , dictionary , location , wlst_param , wlst_value , wlst_path ):
118
+ _method_name = '_add_to_dictionary'
119
+ _logger .finer ('WLSDPLY-06105' , wlst_param , wlst_value , wlst_path , class_name = _class_name ,
120
+ method_name = _method_name )
121
+ try :
122
+ model_param , model_value = self ._aliases .get_model_attribute_name_and_value (location ,
123
+ wlst_param ,
124
+ wlst_value )
125
+ except AliasException , de :
126
+ _logger .info ('WLSDPLY-06106' , wlst_param , wlst_path , de .getLocalizedMessage (),
127
+ class_name = _class_name , method_name = _method_name )
128
+ return
129
+
130
+ model_value = self ._check_attribute (model_param , model_value , location )
131
+ if model_value is not None :
132
+ _logger .finer ('WLSDPLY-06107' , model_param , model_value , class_name = _class_name ,
133
+ method_name = _method_name )
134
+ dictionary [model_param ] = model_value
135
+ elif model_param is None :
136
+ _logger .finest ('WLSDPLY-06108' , model_param , class_name = _class_name , method_name = _method_name )
116
137
117
138
def _get_attributes_for_current_location (self , location ):
118
139
"""
@@ -179,7 +200,7 @@ def _get_required_attributes(self, location):
179
200
:return: list of attributes that require wlst.get
180
201
"""
181
202
_method_name = '_get_required_attributes'
182
- attributes = []
203
+ attributes = list ()
183
204
try :
184
205
attributes = self ._alias_helper .get_wlst_get_required_attribute_names (location )
185
206
except DiscoverException , de :
@@ -188,6 +209,20 @@ def _get_required_attributes(self, location):
188
209
class_name = _class_name , method_name = _method_name )
189
210
return attributes
190
211
212
+ def _get_additional_parameters (self , location ):
213
+ _method_name = '_get_additional_parameters'
214
+ other_attributes = list ()
215
+ try :
216
+ other_attributes = self ._mbean_utils .get_attributes_not_in_lsa_map (location )
217
+ except DiscoverException , de :
218
+ name = 'DomainConfig'
219
+ folders = location .get_model_folders ()
220
+ if len (folders ) > 0 :
221
+ name = location .get_model_folders ()[- 1 ]
222
+ _logger .info ('WLSDPLY-06150' , name , location .get_folder_path (), de .getLocalizedMessage (),
223
+ class_name = _class_name , method_name = _method_name )
224
+ return other_attributes
225
+
191
226
def _mbean_names_exist (self , location ):
192
227
"""
193
228
Check to see if there are any configured MBeans for the current location
0 commit comments