@@ -386,7 +386,7 @@ def _discover_subfolder_with_single_name(self, model_subfolder_name, location, n
386386 _logger .exiting (class_name = _class_name , method_name = _method_name )
387387 return result
388388
389- def _discover_artificial_folder (self , model_subfolder_type , location , name_token ):
389+ def _discover_artificial_folder (self , model_subfolder_type , location , name_token , check_order = False ):
390390 """
391391 Discover the subfolder that has an artificial connection; the subfolder contains multiple different types
392392 under one MBean. The model must contain the subfolder type, the artificial type that specifies which it is,
@@ -395,13 +395,17 @@ def _discover_artificial_folder(self, model_subfolder_type, location, name_token
395395 :param model_subfolder_type: type of the model subfolder
396396 :param location: context containing the current location information
397397 :param name_token: for use in the location to contain the folder name
398+ :param check_order: if true, check the subfolders for order
398399 :return: dictionary containing the discovered folder attributes
399400 """
400401 _method_name = '_discover_artifical_folder'
401402 _logger .entering (model_subfolder_type , str (location ), name_token , class_name = _class_name ,
402403 method_name = _method_name )
403404 subfolder_result = OrderedDict ()
404405 names = self ._find_names_in_folder (location )
406+ required_order = self ._aliases .get_subfolders_in_order (location )
407+ attr_map = dict ()
408+ default_list = list ()
405409 if names is not None :
406410 for name in names :
407411 massaged = self ._inspect_artificial_folder_name (name , location )
@@ -411,6 +415,9 @@ def _discover_artificial_folder(self, model_subfolder_type, location, name_token
411415 if self ._aliases .is_custom_folder_allowed (location ):
412416 _logger .fine ('WLSDPLY-06148' , model_subfolder_type , massaged , location .get_folder_path (),
413417 class_name = _class_name , method_name = _method_name )
418+ # doesn't matter how many parameters, it is automatically a non-default name
419+ default_list .append (massaged )
420+ attr_map [massaged ] = 0
414421 subfolder_result .update (
415422 self ._custom_folder .discover_custom_mbean (location , model_subfolder_type , massaged ))
416423 else :
@@ -423,8 +430,23 @@ def _discover_artificial_folder(self, model_subfolder_type, location, name_token
423430 subfolder_result [massaged ] = OrderedDict ()
424431 subfolder_result [massaged ][artificial ] = OrderedDict ()
425432 self ._populate_model_parameters (subfolder_result [massaged ][artificial ], location )
433+ default_list .append (artificial )
434+ attr_map [artificial ] = len (subfolder_result [massaged ][artificial ])
426435 location .pop_location ()
427436 location .remove_name_token (name_token )
437+
438+ # check to see if the order and number of the subfolder list is same as required order
439+ is_default = False
440+ if check_order and len (required_order ) == len (default_list ):
441+ is_default = True
442+ idx = 0
443+ while idx < len (required_order ):
444+ if required_order [idx ] != default_list [idx ] or attr_map [default_list [idx ]] > 0 :
445+ is_default = False
446+ break
447+ idx += 1
448+ if is_default :
449+ subfolder_result = None
428450 _logger .exiting (class_name = _class_name , method_name = _method_name , result = subfolder_result )
429451 return subfolder_result
430452
@@ -458,12 +480,13 @@ def _discover_subfolder_with_names(self, model_subfolder_name, location, name_to
458480 _logger .exiting (class_name = _class_name , method_name = _method_name )
459481 return subfolder_result
460482
461- def _discover_subfolder (self , model_subfolder_name , location , result = None ):
483+ def _discover_subfolder (self , model_subfolder_name , location , result = None , check_order = False ):
462484 """
463485 Discover the subfolder indicated by the model subfolder name. Append the model subfolder to the
464486 current location context, and pop that location before return
465487 :param model_subfolder_name: Name of the model subfolder
466488 :param location: context containing the current subfolder information
489+ :param check_order: does the folder need to be checked for order
467490 :return: discovered dictionary
468491 """
469492 _method_name = '_discover_subfolder'
@@ -485,22 +508,29 @@ def _discover_subfolder(self, model_subfolder_name, location, result=None):
485508 subfolder_result = self ._discover_subfolder_with_single_name (model_subfolder_name , location ,
486509 name_token )
487510 elif self ._aliases .requires_artificial_type_subfolder_handling (location ):
488- subfolder_result = self ._discover_artificial_folder (model_subfolder_name , location , name_token )
511+ subfolder_result = self ._discover_artificial_folder (
512+ model_subfolder_name , location , name_token , check_order )
489513 else :
490514 subfolder_result = self ._discover_subfolder_with_names (model_subfolder_name , location ,
491515 name_token )
492516 else :
493517 subfolder_result = self ._discover_subfolder_singleton (model_subfolder_name , location )
494- add_to_model_if_not_empty (result , model_subfolder_name , subfolder_result )
518+ # this is a really special case. Empty means not-default it is empty
519+ if self ._aliases .requires_artificial_type_subfolder_handling (location ):
520+ if subfolder_result is not None :
521+ add_to_model (result , model_subfolder_name , subfolder_result )
522+ else :
523+ add_to_model_if_not_empty (result , model_subfolder_name , subfolder_result )
495524 location .pop_location ()
496525 _logger .exiting (class_name = _class_name , method_name = _method_name , result = result )
497526 return result
498527
499- def _discover_subfolders (self , result , location ):
528+ def _discover_subfolders (self , result , location , check_order = False ):
500529 """
501530 Discover the rest of the mbean hierarchy at the current location.
502531 :param result: dictionary where to store the discovered subfolders
503532 :param location: context containing current location information
533+ :param check_order: True if artificial folder has an order to check
504534 :return: populated dictionary
505535 """
506536 _method_name = '_discover_subfolders'
@@ -511,7 +541,7 @@ def _discover_subfolders(self, result, location):
511541 model_subfolder_name = self ._get_model_name (location , wlst_subfolder )
512542 # will return a None if subfolder not in current wls version
513543 if model_subfolder_name is not None :
514- result = self ._discover_subfolder (model_subfolder_name , location , result )
544+ result = self ._discover_subfolder (model_subfolder_name , location , result , check_order )
515545 _logger .finest ('WLSDPLY-06114' , str (location ), class_name = _class_name , method_name = _method_name )
516546 _logger .exiting (class_name = _class_name , method_name = _method_name , result = result )
517547 return result
@@ -790,6 +820,15 @@ def add_to_model_if_not_empty(dictionary, entry_name, entry_value):
790820 return False
791821
792822
823+ def add_to_model (dictionary , entry_name , entry_value ):
824+ """
825+ Add this to the model even if empty
826+ :param dictionary: to add the value
827+ :param entry_name: name of the key
828+ :param entry_value: dictionary to add
829+ """
830+ dictionary [entry_name ] = entry_value
831+
793832def convert_to_absolute_path (relative_to , file_name ):
794833 """
795834 Transform the path by joining the relative_to before the file_name and converting the resulting path name to
0 commit comments