1616from wlsdeploy .exception import exception_helper
1717from wlsdeploy .exception .expection_types import ExceptionType
1818from wlsdeploy .logging .platform_logger import PlatformLogger
19- from wlsdeploy .tool .util .attribute_getter import AttributeGetter
20- from wlsdeploy .tool .util .mbean_getter import MBeanGetter
2119from wlsdeploy .tool .util .alias_helper import AliasHelper
2220from wlsdeploy .tool .util .wlst_helper import WlstHelper
2321from wlsdeploy .util import path_utils
@@ -50,9 +48,9 @@ def __init__(self, model_context, base_location, wlst_mode, aliases=None):
5048 self ._aliases = Aliases (self ._model_context , wlst_mode = self ._wlst_mode )
5149 self ._alias_helper = AliasHelper (self ._aliases , _logger , ExceptionType .DISCOVER )
5250 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 ()
5453 self ._wlst_helper = WlstHelper (_logger , ExceptionType .DISCOVER )
55- self ._mbean_getter = MBeanGetter (self ._aliases , ExceptionType .DISCOVER , _logger )
5654
5755 # methods for use only by the subclasses
5856
@@ -103,7 +101,7 @@ def _populate_model_parameters(self, dictionary, location):
103101 wlst_value )
104102 except AliasException , de :
105103 _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 )
107105 continue
108106
109107 attr_dict [model_param ] = wlst_value
@@ -170,7 +168,7 @@ def _is_defined_attribute(self, location, wlst_name):
170168 try :
171169 if self ._aliases .get_model_attribute_name (location , wlst_name ):
172170 attribute = True
173- except AliasException , ae :
171+ except AliasException :
174172 pass
175173 return attribute
176174
@@ -190,22 +188,6 @@ def _get_required_attributes(self, location):
190188 class_name = _class_name , method_name = _method_name )
191189 return attributes
192190
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-
209191 def _mbean_names_exist (self , location ):
210192 """
211193 Check to see if there are any configured MBeans for the current location
@@ -258,13 +240,7 @@ def _find_names_in_folder(self, location):
258240 _logger .finest ('WLSDPLY-06111' , folder_path , class_name = _class_name , method_name = _method_name )
259241 if wlst_helper .path_exists (folder_path ):
260242 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 ()
268244 _logger .finest ('WLSDPLY-06146' , names , location , class_name = _class_name , method_name = _method_name )
269245 return names
270246
@@ -387,19 +363,19 @@ def _discover_artificial_folder(self, model_subfolder_name, location, name_token
387363 names = self ._find_names_in_folder (location )
388364 if names is not None :
389365 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 )
392368 artificial = self ._get_artificial_type (location )
393369 if artificial is None :
394370 _logger .warning ('WLSDPLY-06123' , self ._alias_helper .get_model_folder_path (location ),
395371 class_name = _class_name , method_name = _method_name )
396372 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 ,
398374 method_name = _method_name )
399375 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 )
403379 location .pop_location ()
404380 location .remove_name_token (name_token )
405381 _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):
439415 """
440416 Discover the subfolder indicated by the model subfolder name. Append the model subfolder to the
441417 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
443419 :param location: context containing the current subfolder information
444420 :return: discovered dictionary
445421 """
446422 _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 )
448425 location .append_location (model_subfolder_name )
449426 _logger .finer ('WLSDPLY-06115' , model_subfolder_name , self ._alias_helper .get_model_folder_path (location ),
450427 class_name = _class_name , method_name = _method_name )
@@ -641,22 +618,6 @@ def _get_wlst_attributes(self, location):
641618 continue
642619 return wlst_attributes
643620
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-
660621 def wlst_cd (self , path , location ):
661622 """
662623 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):
675636 method_name = _method_name )
676637 return result
677638
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
693656
694657
695658def 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):
700663 :param entry_value: to add to dictionary
701664 :return: True if the value was not empty and added to the dictionary
702665 """
703- if entry_value :
666+ _logger .info ('name {0} and value {1}' , entry_name , entry_value )
667+ if entry_value and len (entry_value ):
704668 dictionary [entry_name ] = entry_value
705669 return True
706670 return False
@@ -754,7 +718,7 @@ def _is_attribute_type(attribute_info):
754718 _method_name = '_is_attribute_type'
755719 if not attribute_info .isWritable () and _is_deprecated (attribute_info ):
756720 _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 )
758722 return attribute_info .getDescriptor ().getFieldValue (
759723 'descriptorType' ) == 'Attribute' and attribute_info .getDescriptor ().getFieldValue (
760724 'com.bea.relationship' ) is None and (attribute_info .isWritable () or not _is_deprecated (attribute_info ))
0 commit comments