|
6 | 6 | import java.lang.Boolean as Boolean |
7 | 7 | import java.lang.Double as Double |
8 | 8 | import java.lang.Enum as Enum |
| 9 | +import java.lang.Exception as JException |
9 | 10 | import java.lang.Integer as Integer |
10 | 11 | import java.lang.Long as Long |
11 | 12 | import java.lang.NumberFormatException as NumberFormatException |
@@ -74,7 +75,8 @@ def discover_custom_mbean(self, base_location, model_type, mbean_name): |
74 | 75 | class_name=_class_name, method_name=_method_name) |
75 | 76 | short_name = attribute_helper.get_mbean_name() |
76 | 77 | # 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()) |
78 | 80 | subfolder_result[mbean_name][interface_name] = PyOrderedDict() |
79 | 81 | _logger.info('WLSDPLY-06751', model_type, short_name, class_name=_class_name, method_name=_method_name) |
80 | 82 | _logger.info('WLSDPLY-06752', mbean_name, model_type, short_name, |
@@ -337,20 +339,25 @@ def equal_jarrays(array1, array2): |
337 | 339 | return False |
338 | 340 |
|
339 | 341 |
|
340 | | -def security_provider_interface_name(mbean_interface_name): |
| 342 | +def security_provider_interface_name(mbean_instance, mbean_interface_name): |
341 | 343 | """ |
342 | 344 | Return the name that is used to look up the custom Security Provider MBeanInfo. |
343 | 345 |
|
344 | 346 | This is too tightly coupled to be in this class. |
345 | 347 | This needs something more to differentiate Security Provider Interface which is formatted differently from other |
346 | 348 | custom MBean Interface names. |
| 349 | + :param mbean_instance: instance for the current custom MBean |
347 | 350 | :param mbean_interface_name: interface for the MBean |
348 | 351 | :return: provider class name returned from the massaged MBean name |
349 | 352 | """ |
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] |
354 | 361 | return result |
355 | 362 |
|
356 | 363 |
|
|
0 commit comments