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 .attribute_getter import AttributeGetter
20
- from wlsdeploy .tool .util .mbean_getter import MBeanGetter
21
19
from wlsdeploy .tool .util .alias_helper import AliasHelper
22
20
from wlsdeploy .tool .util .wlst_helper import WlstHelper
23
21
from wlsdeploy .util import path_utils
@@ -50,9 +48,9 @@ def __init__(self, model_context, base_location, wlst_mode, aliases=None):
50
48
self ._aliases = Aliases (self ._model_context , wlst_mode = self ._wlst_mode )
51
49
self ._alias_helper = AliasHelper (self ._aliases , _logger , ExceptionType .DISCOVER )
52
50
self ._att_handler_map = OrderedDict ()
53
- self ._wls_version = WebLogicHelper (_logger ).get_actual_weblogic_version ()
51
+ self ._weblogic_helper = WebLogicHelper (_logger )
52
+ self ._wls_version = self ._weblogic_helper .get_actual_weblogic_version ()
54
53
self ._wlst_helper = WlstHelper (_logger , ExceptionType .DISCOVER )
55
- self ._mbean_getter = MBeanGetter (self ._aliases , ExceptionType .DISCOVER , _logger )
56
54
57
55
# methods for use only by the subclasses
58
56
@@ -103,7 +101,7 @@ def _populate_model_parameters(self, dictionary, location):
103
101
wlst_value )
104
102
except AliasException , de :
105
103
_logger .info ('WLSDPLY-06106' , wlst_param , wlst_path , de .getLocalizedMessage (),
106
- class_name = _class_name , method_name = _method_name )
104
+ class_name = _class_name , method_name = _method_name )
107
105
continue
108
106
109
107
attr_dict [model_param ] = wlst_value
@@ -170,7 +168,7 @@ def _is_defined_attribute(self, location, wlst_name):
170
168
try :
171
169
if self ._aliases .get_model_attribute_name (location , wlst_name ):
172
170
attribute = True
173
- except AliasException , ae :
171
+ except AliasException :
174
172
pass
175
173
return attribute
176
174
@@ -190,22 +188,6 @@ def _get_required_attributes(self, location):
190
188
class_name = _class_name , method_name = _method_name )
191
189
return attributes
192
190
193
- def _method_required_attributes (self , location ):
194
- """
195
- Use a special method to get the online attribute.
196
- :param location: current location context
197
- :return: map of attributes that require special processing via a method
198
- """
199
- _method_name = '_method_required_attributes'
200
- attributes = dict ()
201
- try :
202
- attributes = self ._alias_helper .get_wlst_get_required_attribute_names (location )
203
- except DiscoverException , de :
204
- name = location .get_model_folders ()[- 1 ]
205
- _logger .warning ('WLSDPLY-06109' , name , location .get_folder_path (), de .getLocalizedMessage (),
206
- class_name = _class_name , method_name = _method_name )
207
- return attributes
208
-
209
191
def _mbean_names_exist (self , location ):
210
192
"""
211
193
Check to see if there are any configured MBeans for the current location
@@ -258,13 +240,7 @@ def _find_names_in_folder(self, location):
258
240
_logger .finest ('WLSDPLY-06111' , folder_path , class_name = _class_name , method_name = _method_name )
259
241
if wlst_helper .path_exists (folder_path ):
260
242
self .wlst_cd (folder_path , location )
261
- getter_method = self ._alias_helper .get_folder_names_method (location )
262
- if getter_method :
263
- _logger .finer ('WLSDPLY-06149' , getter_method , location .get_folder_path (), class_name = _class_name ,
264
- method_name = _method_name )
265
- names = self ._call_method_to_get_mbean_names (location , getter_method )
266
- else :
267
- names = self ._wlst_helper .lsc ()
243
+ names = self ._wlst_helper .lsc ()
268
244
_logger .finest ('WLSDPLY-06146' , names , location , class_name = _class_name , method_name = _method_name )
269
245
return names
270
246
@@ -387,19 +363,19 @@ def _discover_artificial_folder(self, model_subfolder_name, location, name_token
387
363
names = self ._find_names_in_folder (location )
388
364
if names is not None :
389
365
for name in names :
390
- _logger . fine ( 'Checking folder name {0}' , name )
391
- location .add_name_token (name_token , name )
366
+ massaged = self . _inspect_artificial_folder_name ( name , location )
367
+ location .add_name_token (name_token , massaged )
392
368
artificial = self ._get_artificial_type (location )
393
369
if artificial is None :
394
370
_logger .warning ('WLSDPLY-06123' , self ._alias_helper .get_model_folder_path (location ),
395
371
class_name = _class_name , method_name = _method_name )
396
372
else :
397
- _logger .finer ('WLSDPLY-06120' , artificial , name , model_subfolder_name , class_name = _class_name ,
373
+ _logger .finer ('WLSDPLY-06120' , artificial , massaged , model_subfolder_name , class_name = _class_name ,
398
374
method_name = _method_name )
399
375
location .append_location (artificial )
400
- subfolder_result [name ] = OrderedDict ()
401
- subfolder_result [name ][artificial ] = OrderedDict ()
402
- self ._populate_model_parameters (subfolder_result [name ][artificial ], location )
376
+ subfolder_result [massaged ] = OrderedDict ()
377
+ subfolder_result [massaged ][artificial ] = OrderedDict ()
378
+ self ._populate_model_parameters (subfolder_result [massaged ][artificial ], location )
403
379
location .pop_location ()
404
380
location .remove_name_token (name_token )
405
381
_logger .exiting (class_name = _class_name , method_name = _method_name , result = subfolder_result )
@@ -439,12 +415,13 @@ def _discover_subfolder(self, model_subfolder_name, location, result=None):
439
415
"""
440
416
Discover the subfolder indicated by the model subfolder name. Append the model subfolder to the
441
417
current location context, and pop that location before return
442
- :param result: dictionary to store the discovered information
418
+ :param model_subfolder_name: Name of the model subfolder
443
419
:param location: context containing the current subfolder information
444
420
:return: discovered dictionary
445
421
"""
446
422
_method_name = '_discover_subfolder'
447
- _logger .entering (model_subfolder_name , class_name = _class_name , method_name = _method_name )
423
+ _logger .entering (model_subfolder_name , location .get_folder_path (), class_name = _class_name ,
424
+ method_name = _method_name )
448
425
location .append_location (model_subfolder_name )
449
426
_logger .finer ('WLSDPLY-06115' , model_subfolder_name , self ._alias_helper .get_model_folder_path (location ),
450
427
class_name = _class_name , method_name = _method_name )
@@ -641,22 +618,6 @@ def _get_wlst_attributes(self, location):
641
618
continue
642
619
return wlst_attributes
643
620
644
- def _call_method_to_get_mbean_names (self , location , getter_method ):
645
- _method_name = '_call_method_to_get_mbean_names'
646
- mbean_names = []
647
- if getter_method is not None :
648
- try :
649
- _logger .finest ('WLSDPLY-12124' , getter_method , location .get_folder_path (),
650
- class_name = _class_name , method_name = _method_name )
651
- get_method = getattr (self ._mbean_getter , getter_method )
652
- mbean_names = get_method (location )
653
- except AttributeError , ae :
654
- ex = exception_helper .create_create_exception ('WLSDPLY-12125' , getter_method , location .get_folder_path ()
655
- , error = ae )
656
- _logger .throwing (ex , class_name = _class_name , method_name = _method_name )
657
- raise ex
658
- return mbean_names
659
-
660
621
def wlst_cd (self , path , location ):
661
622
"""
662
623
Change to the directory specified in the path. If the wlst.cd() fails, assume something is wrong with the
@@ -675,21 +636,23 @@ def wlst_cd(self, path, location):
675
636
method_name = _method_name )
676
637
return result
677
638
678
- def call_get_names_method (self , location , wlst_method ):
679
- _method_name = 'call_get_method'
680
- _logger .entering (str (location ), wlst_method , class_name = _class_name , method_name = _method_name )
681
- try :
682
- _logger .fine ('WLSDPLY-06147' , wlst_method , self ._alias_helper .get_model_folder_path (location ),
683
- class_name = _class_name , method_name = _method_name )
684
- get_method = getattr (self ._mbean_getter , wlst_method )
685
- mbean_names = get_method (location )
686
- except AttributeError , ae :
687
- ex = exception_helper .create_create_exception ('WLSDPLY-06148' , wlst_method ,
688
- self ._alias_helper .get_model_folder_path (location ), error = ae )
689
- _logger .throwing (ex , class_name = _class_name , method_name = _method_name )
690
- raise ex
691
- _logger .exiting (class_name = _class_name , method_name = _method_name , result = mbean_names )
692
- return mbean_names
639
+ def _inspect_artificial_folder_name (self , folder_name , location ):
640
+ """
641
+ Perform any special handling for the folder or folder names.
642
+ :param location: current context of location
643
+ :return: Original name or processed name value
644
+ """
645
+ return self ._inspect_security_folder_name (folder_name , location )
646
+
647
+ def _inspect_security_folder_name (self , folder_name , location ):
648
+ # This is so clunky. My alias definition change was rejected.
649
+ if (not self ._weblogic_helper .is_version_in_12c ()) and self ._wlst_mode == WlstModes .OFFLINE and \
650
+ 'SecurityConfiguration' in location .get_folder_path () and 'Provider' == folder_name :
651
+ raise exception_helper .create_discover_exception ('WLSDPLY-06201' , folder_name , location .get_folder_path ())
652
+ _logger .info ('version {0} mode {1} folder {2} provider {3}' , not self ._weblogic_helper .is_version_in_12c (),
653
+ self ._wlst_mode == WlstModes .OFFLINE , 'SecurityConfiguration' in location .get_folder_path (),
654
+ 'Provider' == folder_name )
655
+ return folder_name
693
656
694
657
695
658
def add_to_model_if_not_empty (dictionary , entry_name , entry_value ):
@@ -700,7 +663,8 @@ def add_to_model_if_not_empty(dictionary, entry_name, entry_value):
700
663
:param entry_value: to add to dictionary
701
664
:return: True if the value was not empty and added to the dictionary
702
665
"""
703
- if entry_value :
666
+ _logger .info ('name {0} and value {1}' , entry_name , entry_value )
667
+ if entry_value and len (entry_value ):
704
668
dictionary [entry_name ] = entry_value
705
669
return True
706
670
return False
@@ -754,7 +718,7 @@ def _is_attribute_type(attribute_info):
754
718
_method_name = '_is_attribute_type'
755
719
if not attribute_info .isWritable () and _is_deprecated (attribute_info ):
756
720
_logger .finer ('WLSDPLY-06143' , attribute_info .getName (), wlst_helper .get_pwd (),
757
- class_name = _class_name , method_name = _method_name )
721
+ class_name = _class_name , method_name = _method_name )
758
722
return attribute_info .getDescriptor ().getFieldValue (
759
723
'descriptorType' ) == 'Attribute' and attribute_info .getDescriptor ().getFieldValue (
760
724
'com.bea.relationship' ) is None and (attribute_info .isWritable () or not _is_deprecated (attribute_info ))
0 commit comments