@@ -139,22 +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 )
144144 try :
145- attributes = wlst_helper .lsa (path )
146- mbean_attributes = wlst_helper .get_mbi ().getAttributes ()
147- if mbean_attributes :
148- alias_attributes = self ._get_wlst_attributes (location )
149- for mbean_attribute in mbean_attributes :
150- name = mbean_attribute .getName ()
151- if name not in attributes and name in alias_attributes :
152- attributes [name ] = wlst_helper .get (name )
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 )
153159 except PyWLSTException , pe :
154160 name = location .get_model_folders ()[- 1 ]
155161 _logger .fine ('WLSDPLY-06109' , name , str (location ), pe .getLocalizedMessage (), class_name = _class_name ,
156162 method_name = _method_name )
157- return attributes
163+ return lsa_attributes
158164
159165 def _is_defined_attribute (self , location , wlst_name ):
160166 attribute = False
@@ -584,7 +590,7 @@ def _get_wlst_attributes(self, location):
584590 wlst_attribute = self ._aliases .get_wlst_attribute_name (location , model_attribute )
585591 if wlst_attribute :
586592 wlst_attributes .append (wlst_attribute )
587- except AliasException , ae :
593+ except AliasException :
588594 continue
589595 return wlst_attributes
590596
@@ -634,6 +640,39 @@ def convert_to_absolute_path(relative_to, file_name):
634640 return file_name
635641
636642
643+ def _get_mbi_attribute_list ():
644+ attribute_list = []
645+ for mbean_attribute_info in wlst_helper .get_mbi ().getAttributes ():
646+ if _is_attribute (mbean_attribute_info ):
647+ attribute_list .append (mbean_attribute_info .getName ())
648+ return attribute_list
649+
650+
651+ def _is_attribute (attributes_info ):
652+ return _is_attribute_type (attributes_info ) or _is_valid_reference (attributes_info )
653+
654+
655+ def _is_valid_reference (attribute_info ):
656+ # check again after all done to see whether need to use get deprecated
657+ return _is_reference (attribute_info ) and (
658+ attribute_info .isWritable () is True and not _is_deprecated (attribute_info ))
659+
660+
661+ def _is_reference (mbean_attribute_info ):
662+ return mbean_attribute_info .getDescriptor ().getFieldValue ('com.bea.relationship' ) == 'reference'
663+
664+
665+ def _is_deprecated (mbean_attribute_info ):
666+ deprecated_version = mbean_attribute_info .getDescriptor ().getFieldValue ('deprecated' )
667+ return deprecated_version is not None and deprecated_version != 'null' and len (deprecated_version ) > 1
668+
669+
670+ def _is_attribute_type (attribute_info ):
671+ return attribute_info .getDescriptor ().getFieldValue (
672+ 'descriptorType' ) == 'Attribute' and attribute_info .getDescriptor ().getFieldValue (
673+ 'com.bea.relationship' ) is None
674+
675+
637676def get_discover_logger_name ():
638677 """
639678 Return the common logger used for all discover logging.
0 commit comments