Skip to content

Commit c1e6fa6

Browse files
JIRA WDT-61 redesign the concept
1 parent 7c67b23 commit c1e6fa6

File tree

13 files changed

+64
-373
lines changed

13 files changed

+64
-373
lines changed

core/src/main/python/wlsdeploy/aliases/alias_constants.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
GET_MBEAN_TYPE = 'get_mbean_type'
1919
GET_METHOD = 'get_method'
2020
MERGE = 'merge'
21-
METHOD = 'METHOD'
2221
MODEL_NAME = 'model_name'
2322
NAME_VALUE = 'name_value'
2423
PASSWORD_TOKEN = "--FIX ME--"
@@ -60,7 +59,6 @@
6059
GET = 'GET'
6160
LSA = 'LSA'
6261
NONE = 'NONE'
63-
NAMES = 'NAMES'
6462

6563
# set_method values
6664
MBEAN = 'MBEAN'

core/src/main/python/wlsdeploy/aliases/alias_entries.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -429,21 +429,6 @@ def get_wlst_create_path_for_location(self, location):
429429
_logger.exiting(class_name=_class_name, method_name=_method_name, result=result)
430430
return result
431431

432-
def get_folder_get_method_for_location(self, location):
433-
"""
434-
Return the value of the folder get_method attribute if present.
435-
:param location: current location context of the folder
436-
:return: String value, or None if not present
437-
"""
438-
_method_name = 'get_folder_get_method_for_location'
439-
_logger.entering(str(location), class_name=_class_name, method_name=_method_name)
440-
folder_dict = self.__get_dictionary_for_location(location, False)
441-
get_method = None
442-
if folder_dict is not None and GET_METHOD in folder_dict and len(folder_dict[GET_METHOD]) > 0:
443-
get_method = folder_dict[GET_METHOD]
444-
_logger.exiting(class_name=_class_name, method_name=_method_name, result=get_method)
445-
return get_method
446-
447432
def is_location_child_folder_type(self, location, child_folders_type):
448433
"""
449434
Does the location folder have the specified child_folders_type?
@@ -1138,9 +1123,6 @@ def __apply_wlst_context_changes(self, path_name, alias_dict, parent_dict):
11381123
if DEFAULT_NAME_VALUE in alias_dict:
11391124
result[DEFAULT_NAME_VALUE] = self._resolve_curly_braces(alias_dict[DEFAULT_NAME_VALUE])
11401125

1141-
if GET_METHOD in alias_dict:
1142-
result[GET_METHOD] = self._resolve_curly_braces(alias_dict[GET_METHOD])
1143-
11441126
if WLST_PATHS in alias_dict:
11451127
wlst_paths = alias_dict[WLST_PATHS]
11461128
result_wlst_paths = dict()

core/src/main/python/wlsdeploy/aliases/aliases.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@
3535
from wlsdeploy.aliases.alias_constants import LSA
3636
from wlsdeploy.aliases.alias_constants import MBEAN
3737
from wlsdeploy.aliases.alias_constants import MERGE
38-
from wlsdeploy.aliases.alias_constants import METHOD
3938
from wlsdeploy.aliases.alias_constants import MODEL_NAME
40-
from wlsdeploy.aliases.alias_constants import NAMES
4139
from wlsdeploy.aliases.alias_constants import PASSWORD
4240
from wlsdeploy.aliases.alias_constants import PASSWORD_TOKEN
4341
from wlsdeploy.aliases.alias_constants import PREFERRED_MODEL_TYPE
@@ -260,24 +258,6 @@ def requires_artificial_type_subfolder_handling(self, location):
260258
return self._alias_entries.is_location_child_folder_type(location,
261259
ChildFoldersTypes.MULTIPLE_WITH_TYPE_SUBFOLDER)
262260

263-
def get_folder_names_method(self, location):
264-
"""
265-
Return the method_name from the folder get_method attribute.
266-
None if not present for the folder. The get_method must start
267-
with "NAMES." or None is returned. The "NAMES." prefix is
268-
stripped from the method name. The NAMES method returns a
269-
list of mbean names at the current location.
270-
:param location: current location context
271-
:return: method name if NAMES method is defined for the folder
272-
"""
273-
names_method = None
274-
get_method = self._alias_entries.get_folder_get_method_for_location(location)
275-
method_type = NAMES + '.'
276-
if get_method and get_method.startswith(method_type):
277-
names_method = get_method[len(method_type):]
278-
279-
return names_method
280-
281261
def supports_single_mbean_instance(self, location):
282262
"""
283263
Does the location folder specified support only a single MBean instance of the parent node type?

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

Lines changed: 34 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
from wlsdeploy.exception import exception_helper
1717
from wlsdeploy.exception.expection_types import ExceptionType
1818
from wlsdeploy.logging.platform_logger import PlatformLogger
19-
from wlsdeploy.tool.util.attribute_getter import AttributeGetter
20-
from wlsdeploy.tool.util.mbean_getter import MBeanGetter
2119
from wlsdeploy.tool.util.alias_helper import AliasHelper
2220
from wlsdeploy.tool.util.wlst_helper import WlstHelper
2321
from wlsdeploy.util import path_utils
@@ -50,9 +48,9 @@ def __init__(self, model_context, base_location, wlst_mode, aliases=None):
5048
self._aliases = Aliases(self._model_context, wlst_mode=self._wlst_mode)
5149
self._alias_helper = AliasHelper(self._aliases, _logger, ExceptionType.DISCOVER)
5250
self._att_handler_map = OrderedDict()
53-
self._wls_version = WebLogicHelper(_logger).get_actual_weblogic_version()
51+
self._weblogic_helper = WebLogicHelper(_logger)
52+
self._wls_version = self._weblogic_helper.get_actual_weblogic_version()
5453
self._wlst_helper = WlstHelper(_logger, ExceptionType.DISCOVER)
55-
self._mbean_getter = MBeanGetter(self._aliases, ExceptionType.DISCOVER, _logger)
5654

5755
# methods for use only by the subclasses
5856

@@ -103,7 +101,7 @@ def _populate_model_parameters(self, dictionary, location):
103101
wlst_value)
104102
except AliasException, de:
105103
_logger.info('WLSDPLY-06106', wlst_param, wlst_path, de.getLocalizedMessage(),
106-
class_name=_class_name, method_name=_method_name)
104+
class_name=_class_name, method_name=_method_name)
107105
continue
108106

109107
attr_dict[model_param] = wlst_value
@@ -170,7 +168,7 @@ def _is_defined_attribute(self, location, wlst_name):
170168
try:
171169
if self._aliases.get_model_attribute_name(location, wlst_name):
172170
attribute = True
173-
except AliasException, ae:
171+
except AliasException:
174172
pass
175173
return attribute
176174

@@ -190,22 +188,6 @@ def _get_required_attributes(self, location):
190188
class_name=_class_name, method_name=_method_name)
191189
return attributes
192190

193-
def _method_required_attributes(self, location):
194-
"""
195-
Use a special method to get the online attribute.
196-
:param location: current location context
197-
:return: map of attributes that require special processing via a method
198-
"""
199-
_method_name = '_method_required_attributes'
200-
attributes = dict()
201-
try:
202-
attributes = self._alias_helper.get_wlst_get_required_attribute_names(location)
203-
except DiscoverException, de:
204-
name = location.get_model_folders()[-1]
205-
_logger.warning('WLSDPLY-06109', name, location.get_folder_path(), de.getLocalizedMessage(),
206-
class_name=_class_name, method_name=_method_name)
207-
return attributes
208-
209191
def _mbean_names_exist(self, location):
210192
"""
211193
Check to see if there are any configured MBeans for the current location
@@ -258,13 +240,7 @@ def _find_names_in_folder(self, location):
258240
_logger.finest('WLSDPLY-06111', folder_path, class_name=_class_name, method_name=_method_name)
259241
if wlst_helper.path_exists(folder_path):
260242
self.wlst_cd(folder_path, location)
261-
getter_method = self._alias_helper.get_folder_names_method(location)
262-
if getter_method:
263-
_logger.finer('WLSDPLY-06149', getter_method, location.get_folder_path(), class_name=_class_name,
264-
method_name=_method_name)
265-
names = self._call_method_to_get_mbean_names(location, getter_method)
266-
else:
267-
names = self._wlst_helper.lsc()
243+
names = self._wlst_helper.lsc()
268244
_logger.finest('WLSDPLY-06146', names, location, class_name=_class_name, method_name=_method_name)
269245
return names
270246

@@ -387,19 +363,19 @@ def _discover_artificial_folder(self, model_subfolder_name, location, name_token
387363
names = self._find_names_in_folder(location)
388364
if names is not None:
389365
for name in names:
390-
_logger.fine('Checking folder name {0}', name)
391-
location.add_name_token(name_token, name)
366+
massaged = self._inspect_artificial_folder_name(name, location)
367+
location.add_name_token(name_token, massaged)
392368
artificial = self._get_artificial_type(location)
393369
if artificial is None:
394370
_logger.warning('WLSDPLY-06123', self._alias_helper.get_model_folder_path(location),
395371
class_name=_class_name, method_name=_method_name)
396372
else:
397-
_logger.finer('WLSDPLY-06120', artificial, name, model_subfolder_name, class_name=_class_name,
373+
_logger.finer('WLSDPLY-06120', artificial, massaged, model_subfolder_name, class_name=_class_name,
398374
method_name=_method_name)
399375
location.append_location(artificial)
400-
subfolder_result[name] = OrderedDict()
401-
subfolder_result[name][artificial] = OrderedDict()
402-
self._populate_model_parameters(subfolder_result[name][artificial], location)
376+
subfolder_result[massaged] = OrderedDict()
377+
subfolder_result[massaged][artificial] = OrderedDict()
378+
self._populate_model_parameters(subfolder_result[massaged][artificial], location)
403379
location.pop_location()
404380
location.remove_name_token(name_token)
405381
_logger.exiting(class_name=_class_name, method_name=_method_name, result=subfolder_result)
@@ -439,12 +415,13 @@ def _discover_subfolder(self, model_subfolder_name, location, result=None):
439415
"""
440416
Discover the subfolder indicated by the model subfolder name. Append the model subfolder to the
441417
current location context, and pop that location before return
442-
:param result: dictionary to store the discovered information
418+
:param model_subfolder_name: Name of the model subfolder
443419
:param location: context containing the current subfolder information
444420
:return: discovered dictionary
445421
"""
446422
_method_name = '_discover_subfolder'
447-
_logger.entering(model_subfolder_name, class_name=_class_name, method_name=_method_name)
423+
_logger.entering(model_subfolder_name, location.get_folder_path(), class_name=_class_name,
424+
method_name=_method_name)
448425
location.append_location(model_subfolder_name)
449426
_logger.finer('WLSDPLY-06115', model_subfolder_name, self._alias_helper.get_model_folder_path(location),
450427
class_name=_class_name, method_name=_method_name)
@@ -641,22 +618,6 @@ def _get_wlst_attributes(self, location):
641618
continue
642619
return wlst_attributes
643620

644-
def _call_method_to_get_mbean_names(self, location, getter_method):
645-
_method_name = '_call_method_to_get_mbean_names'
646-
mbean_names = []
647-
if getter_method is not None:
648-
try:
649-
_logger.finest('WLSDPLY-12124', getter_method, location.get_folder_path(),
650-
class_name=_class_name, method_name=_method_name)
651-
get_method = getattr(self._mbean_getter, getter_method)
652-
mbean_names = get_method(location)
653-
except AttributeError, ae:
654-
ex = exception_helper.create_create_exception('WLSDPLY-12125', getter_method, location.get_folder_path()
655-
, error=ae)
656-
_logger.throwing(ex, class_name=_class_name, method_name=_method_name)
657-
raise ex
658-
return mbean_names
659-
660621
def wlst_cd(self, path, location):
661622
"""
662623
Change to the directory specified in the path. If the wlst.cd() fails, assume something is wrong with the
@@ -675,21 +636,23 @@ def wlst_cd(self, path, location):
675636
method_name=_method_name)
676637
return result
677638

678-
def call_get_names_method(self, location, wlst_method):
679-
_method_name = 'call_get_method'
680-
_logger.entering(str(location), wlst_method, class_name=_class_name, method_name=_method_name)
681-
try:
682-
_logger.fine('WLSDPLY-06147', wlst_method, self._alias_helper.get_model_folder_path(location),
683-
class_name=_class_name, method_name=_method_name)
684-
get_method = getattr(self._mbean_getter, wlst_method)
685-
mbean_names = get_method(location)
686-
except AttributeError, ae:
687-
ex = exception_helper.create_create_exception('WLSDPLY-06148', wlst_method,
688-
self._alias_helper.get_model_folder_path(location), error=ae)
689-
_logger.throwing(ex, class_name=_class_name, method_name=_method_name)
690-
raise ex
691-
_logger.exiting(class_name=_class_name, method_name=_method_name, result=mbean_names)
692-
return mbean_names
639+
def _inspect_artificial_folder_name(self, folder_name, location):
640+
"""
641+
Perform any special handling for the folder or folder names.
642+
:param location: current context of location
643+
:return: Original name or processed name value
644+
"""
645+
return self._inspect_security_folder_name(folder_name, location)
646+
647+
def _inspect_security_folder_name(self, folder_name, location):
648+
# This is so clunky. My alias definition change was rejected.
649+
if (not self._weblogic_helper.is_version_in_12c()) and self._wlst_mode == WlstModes.OFFLINE and \
650+
'SecurityConfiguration' in location.get_folder_path() and 'Provider' == folder_name:
651+
raise exception_helper.create_discover_exception('WLSDPLY-06201', folder_name, location.get_folder_path())
652+
_logger.info('version {0} mode {1} folder {2} provider {3}', not self._weblogic_helper.is_version_in_12c(),
653+
self._wlst_mode == WlstModes.OFFLINE, 'SecurityConfiguration' in location.get_folder_path(),
654+
'Provider' == folder_name)
655+
return folder_name
693656

694657

695658
def add_to_model_if_not_empty(dictionary, entry_name, entry_value):
@@ -700,7 +663,8 @@ def add_to_model_if_not_empty(dictionary, entry_name, entry_value):
700663
:param entry_value: to add to dictionary
701664
:return: True if the value was not empty and added to the dictionary
702665
"""
703-
if entry_value:
666+
_logger.info('name {0} and value {1}', entry_name, entry_value)
667+
if entry_value and len(entry_value):
704668
dictionary[entry_name] = entry_value
705669
return True
706670
return False
@@ -754,7 +718,7 @@ def _is_attribute_type(attribute_info):
754718
_method_name = '_is_attribute_type'
755719
if not attribute_info.isWritable() and _is_deprecated(attribute_info):
756720
_logger.finer('WLSDPLY-06143', attribute_info.getName(), wlst_helper.get_pwd(),
757-
class_name=_class_name, method_name=_method_name)
721+
class_name=_class_name, method_name=_method_name)
758722
return attribute_info.getDescriptor().getFieldValue(
759723
'descriptorType') == 'Attribute' and attribute_info.getDescriptor().getFieldValue(
760724
'com.bea.relationship') is None and (attribute_info.isWritable() or not _is_deprecated(attribute_info))

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from java.io import File
66
from java.lang import IllegalArgumentException
77

8+
from oracle.weblogic.deploy.discover import DiscoverException
89
from oracle.weblogic.deploy.util import PyOrderedDict as OrderedDict
910
from oracle.weblogic.deploy.util import PyWLSTException
1011
from oracle.weblogic.deploy.util import StringUtils
@@ -290,7 +291,12 @@ def discover_security_configuration(self):
290291
if security_configuration is not None:
291292
_logger.info('WLSDPLY-06622', class_name=_class_name, method_name=_method_name)
292293
self._populate_model_parameters(result, location)
293-
self._discover_subfolders(result, location)
294+
try:
295+
self._discover_subfolders(result, location)
296+
except DiscoverException, de:
297+
_logger.warning('WLSDPLY-06200', self._wls_version, de.getLocalizedMessage(),
298+
class_name=_class_name, method_name=_method_name)
299+
result = OrderedDict()
294300
_logger.exiting(class_name=_class_name, method_name=_method_name)
295301
return model_top_folder_name, result
296302

core/src/main/python/wlsdeploy/tool/util/alias_helper.py

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
33
The Universal Permissive License (UPL), Version 1.0
44
"""
55
from oracle.weblogic.deploy.aliases import AliasException
@@ -610,25 +610,6 @@ def get_wlst_get_required_attribute_names(self, location):
610610
raise ex
611611
return result
612612

613-
def get_wlst_method_required_attribute_names(self, location):
614-
"""
615-
Get the list of attribute names that require special processing via a method
616-
:param location: the location
617-
:return: dict[string=string]: the dictionary of attribute names and the attribute's method
618-
:raises: BundleAwareException of the specified type: if an error occurs
619-
"""
620-
_method_name = 'get_wlst_method_required_attribute_names'
621-
622-
try:
623-
result = self.__aliases.get_wlst_method_required_attribute_names(location)
624-
except AliasException, ae:
625-
ex = exception_helper.create_exception(self.__exception_type, 'WLSDPLY-19034',
626-
location.get_current_model_folder(), location.get_folder_path(),
627-
ae.getLocalizedMessage(), error=ae)
628-
self.__logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
629-
raise ex
630-
return result
631-
632613
def get_model_subfolder_name(self, location, wlst_name):
633614
"""
634615
Get the model folder name for the WLST subfolder name at the specified location.
@@ -707,24 +688,6 @@ def get_model_attribute_default_value(self, location, model_attribute_name):
707688
raise ex
708689
return result
709690

710-
def get_folder_names_method(self, location):
711-
"""
712-
Get the method for retrieving the folder names for the folder at the current location
713-
:param location: current location context
714-
:return: method name or None if not present for the folder
715-
"""
716-
_method_name = 'get_folder_names_method'
717-
718-
try:
719-
getter_method = self.__aliases.get_folder_names_method(location)
720-
except AliasException, ae:
721-
ex = exception_helper.create_exception(self.__exception_type, 'WLSDPLY-19035',
722-
location.get_model_folders()[-1], location.get_folder_path(),
723-
ae.getLocalizedMessage(), error=ae)
724-
self.__logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
725-
raise ex
726-
return getter_method
727-
728691
###########################################################################
729692
# Convenience Methods #
730693
###########################################################################

0 commit comments

Comments
 (0)