Skip to content

Commit d7b3e55

Browse files
CarolynRountreeddsharpe
authored andcommitted
Jira#375 use getProviderClassName (#475)
1 parent cb19b1f commit d7b3e55

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

core/src/main/python/wlsdeploy/tool/discover/custom_folder_helper.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import java.lang.Boolean as Boolean
77
import java.lang.Double as Double
88
import java.lang.Enum as Enum
9+
import java.lang.Exception as JException
910
import java.lang.Integer as Integer
1011
import java.lang.Long as Long
1112
import java.lang.NumberFormatException as NumberFormatException
@@ -74,7 +75,8 @@ def discover_custom_mbean(self, base_location, model_type, mbean_name):
7475
class_name=_class_name, method_name=_method_name)
7576
short_name = attribute_helper.get_mbean_name()
7677
# This is not like other custom interface names and should be changed to be more flexible
77-
interface_name = security_provider_interface_name(attribute_helper.get_mbean_interface_name())
78+
interface_name = security_provider_interface_name(attribute_helper.get_mbean_instance(),
79+
attribute_helper.get_mbean_interface_name())
7880
subfolder_result[mbean_name][interface_name] = PyOrderedDict()
7981
_logger.info('WLSDPLY-06751', model_type, short_name, class_name=_class_name, method_name=_method_name)
8082
_logger.info('WLSDPLY-06752', mbean_name, model_type, short_name,
@@ -337,20 +339,25 @@ def equal_jarrays(array1, array2):
337339
return False
338340

339341

340-
def security_provider_interface_name(mbean_interface_name):
342+
def security_provider_interface_name(mbean_instance, mbean_interface_name):
341343
"""
342344
Return the name that is used to look up the custom Security Provider MBeanInfo.
343345
344346
This is too tightly coupled to be in this class.
345347
This needs something more to differentiate Security Provider Interface which is formatted differently from other
346348
custom MBean Interface names.
349+
:param mbean_instance: instance for the current custom MBean
347350
:param mbean_interface_name: interface for the MBean
348351
:return: provider class name returned from the massaged MBean name
349352
"""
350-
result = mbean_interface_name
351-
idx = mbean_interface_name.rfind('MBean')
352-
if idx > 0:
353-
result = result[:idx]
353+
try:
354+
getter = getattr(mbean_instance, 'getProviderClassName')
355+
result = getter()
356+
except (Exception, JException):
357+
result = mbean_interface_name
358+
idx = mbean_interface_name.rfind('MBean')
359+
if idx > 0:
360+
result = result[:idx]
354361
return result
355362

356363

0 commit comments

Comments
 (0)