@@ -99,7 +99,7 @@ def _populate_model_parameters(self, dictionary, location):
9999 wlst_param ,
100100 wlst_value )
101101 except AliasException , de :
102- _logger .warning ('WLSDPLY-06106' , wlst_param , wlst_path , de .getLocalizedMessage (),
102+ _logger .info ('WLSDPLY-06106' , wlst_param , wlst_path , de .getLocalizedMessage (),
103103 class_name = _class_name , method_name = _method_name )
104104 continue
105105
@@ -139,24 +139,28 @@ def _get_attributes_for_current_location_offline(self, location):
139139
140140 def _get_attributes_for_current_location_online (self , location ):
141141 _method_name = '_get_attributes_for_current_location_online'
142- attributes = dict ()
142+ lsa_attributes = dict ()
143143 path = self ._alias_helper .get_wlst_attributes_path (location )
144- added = False
145144 try :
146- attributes = wlst_helper .lsa (path )
147- mbean_attributes = wlst_helper .get_mbi ().getAttributes ()
148- if mbean_attributes :
149- alias_attributes = self ._get_wlst_attributes (location )
150- for mbean_attribute in mbean_attributes :
151- name = mbean_attribute .getName ()
152- if name not in attributes and name in alias_attributes :
153- attributes [name ] = wlst_helper .get (name )
154- added = True
145+ lsa_attributes = wlst_helper .lsa (path )
146+ mbi_attributes = _get_mbi_attribute_list ()
147+ if mbi_attributes :
148+ for lsa_attribute_name in lsa_attributes :
149+ if lsa_attribute_name in lsa_attributes and lsa_attribute_name not in mbi_attributes :
150+ _logger .finer ('WLSDPLY-06142' , lsa_attribute_name )
151+ del lsa_attributes [lsa_attribute_name ]
152+ for mbi_attribute_name in mbi_attributes :
153+ if mbi_attribute_name not in lsa_attributes and mbi_attribute_name in mbi_attributes :
154+ # don't count on the item in the get required list in caller, just get the value
155+ # and add it to our lsa list
156+ _logger .finer ('WLSDPLY-06141' , mbi_attribute_name , class_name = _class_name ,
157+ method_name = _method_name )
158+ lsa_attributes [mbi_attribute_name ] = wlst_helper .get (mbi_attribute_name )
155159 except PyWLSTException , pe :
156160 name = location .get_model_folders ()[- 1 ]
157161 _logger .fine ('WLSDPLY-06109' , name , str (location ), pe .getLocalizedMessage (), class_name = _class_name ,
158162 method_name = _method_name )
159- return attributes
163+ return lsa_attributes
160164
161165 def _is_defined_attribute (self , location , wlst_name ):
162166 attribute = False
@@ -260,6 +264,11 @@ def _find_singleton_name_in_folder(self, location):
260264 return name
261265
262266 def _find_subfolders (self , location ):
267+ if self ._wlst_mode == WlstModes .OFFLINE :
268+ return self ._find_subfolders_offline (location )
269+ else :
270+ return self ._find_subfolders_online (location )
271+ def _find_subfolders_offline (self , location ):
263272 """
264273 Find the subfolders of the current location.
265274 :param location: context containing current location information
@@ -278,6 +287,20 @@ def _find_subfolders(self, location):
278287 wlst_subfolders = new_subfolders
279288 return wlst_subfolders
280289
290+ def _find_subfolders_online (self , location ):
291+ wlst_path = self ._alias_helper .get_wlst_subfolders_path (location )
292+ wlst_subfolders = []
293+ if self .wlst_cd (wlst_path , location ):
294+ wlst_subfolders = _massage_online_folders (self ._wlst_helper .lsc ())
295+ if wlst_subfolders :
296+ new_subfolders = []
297+ for wlst_subfolder in wlst_subfolders :
298+ model_subfolder_name = self ._get_model_name (location , wlst_subfolder )
299+ if model_subfolder_name :
300+ new_subfolders .append (wlst_subfolder )
301+ wlst_subfolders = new_subfolders
302+ return wlst_subfolders
303+
281304 def _discover_subfolder_singleton (self , model_subfolder_name , location ):
282305 """
283306 Discover the subfolder from the wlst subfolder name. populate the attributes in the folder.
@@ -586,7 +609,7 @@ def _get_wlst_attributes(self, location):
586609 wlst_attribute = self ._aliases .get_wlst_attribute_name (location , model_attribute )
587610 if wlst_attribute :
588611 wlst_attributes .append (wlst_attribute )
589- except AliasException , ae :
612+ except AliasException :
590613 continue
591614 return wlst_attributes
592615
@@ -636,6 +659,66 @@ def convert_to_absolute_path(relative_to, file_name):
636659 return file_name
637660
638661
662+ def _get_mbi_attribute_list ():
663+ attribute_list = []
664+ for mbean_attribute_info in wlst_helper .get_mbi ().getAttributes ():
665+ if _is_attribute (mbean_attribute_info ):
666+ attribute_list .append (mbean_attribute_info .getName ())
667+ return attribute_list
668+
669+
670+ def _is_attribute (attributes_info ):
671+ return _is_attribute_type (attributes_info ) or _is_valid_reference (attributes_info )
672+
673+
674+ def _is_valid_reference (attribute_info ):
675+ # check again after all done to see whether need to use get deprecated
676+ return _is_reference (attribute_info ) and (
677+ attribute_info .isWritable () or not _is_deprecated (attribute_info ))
678+
679+
680+ def _is_reference (mbean_attribute_info ):
681+ return mbean_attribute_info .getDescriptor ().getFieldValue ('com.bea.relationship' ) == 'reference'
682+
683+
684+ def _is_deprecated (mbean_attribute_info ):
685+ deprecated_version = mbean_attribute_info .getDescriptor ().getFieldValue ('deprecated' )
686+ return deprecated_version is not None and deprecated_version != 'null' and len (deprecated_version ) > 1
687+
688+
689+ def _is_containment (mbean_attribute_info ):
690+ return mbean_attribute_info .getDescriptor ().getFieldValue ('com.bea.relationship' ) == 'containment'
691+
692+
693+ def _is_attribute_type (attribute_info ):
694+ _method_name = '_is_attribute_type'
695+ if not attribute_info .isWritable () and _is_deprecated (attribute_info ):
696+ _logger .finer ('WLSDPLY-06143' , attribute_info .getName (), wlst_helper .get_pwd (),
697+ class_name = _class_name , method_name = _method_name )
698+ return attribute_info .getDescriptor ().getFieldValue (
699+ 'descriptorType' ) == 'Attribute' and attribute_info .getDescriptor ().getFieldValue (
700+ 'com.bea.relationship' ) is None and (attribute_info .isWritable () or not _is_deprecated (attribute_info ))
701+
702+
703+ def _massage_online_folders (lsc_folders ):
704+ _method_name = '_massage_online_folders'
705+ location = wlst_helper .get_pwd ()
706+ folder_list = []
707+ mbi_folder_list = []
708+ for mbean_attribute_info in wlst_helper .get_mbi ().getAttributes ():
709+ if _is_containment (mbean_attribute_info ):
710+ mbi_folder_list .append (mbean_attribute_info .getName ())
711+ for lsc_folder in lsc_folders :
712+ if lsc_folder in mbi_folder_list :
713+ folder_list .append (lsc_folder )
714+ else :
715+ _logger .finer ('WLSDPLY-06144' , lsc_folder , location , class_name = _class_name , method_name = _method_name )
716+ if len (folder_list ) != len (mbi_folder_list ):
717+ _logger .fine ('WLSDPLY-06145' , folder_list , location , mbi_folder_list , class_name = _class_name ,
718+ method_name = _method_name )
719+ return folder_list
720+
721+
639722def get_discover_logger_name ():
640723 """
641724 Return the common logger used for all discover logging.
0 commit comments