Skip to content

Commit 852895f

Browse files
committed
Issue #275 - Join discovered lists using comma delimiter only; split classpath on comma when adding to archive
1 parent ca7a28f commit 852895f

File tree

2 files changed

+31
-18
lines changed

2 files changed

+31
-18
lines changed

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

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
from wlsdeploy.aliases.alias_constants import JAVA_LANG_BOOLEAN
3636
from wlsdeploy.aliases.alias_constants import LIST
3737
from wlsdeploy.aliases.alias_constants import LONG
38+
from wlsdeploy.aliases.model_constants import MODEL_LIST_DELIMITER
3839
from wlsdeploy.aliases.alias_constants import PATH_SEPARATOR_DELIMITED_STRING
3940
from wlsdeploy.aliases.alias_constants import PREFERRED_MODEL_TYPE
4041
from wlsdeploy.aliases.alias_constants import SECURITY_PROVIDER_FOLDER_PATHS
@@ -663,12 +664,12 @@ def get_number_of_directories_to_strip(desired_path_type, actual_path_type):
663664

664665
def convert_from_type(data_type, value, preferred=None, delimiter=None):
665666
"""
666-
Convert from wlst type
667-
:param data_type: type of data
668-
:param value: value of data
669-
:param preferred: how it should be represented
670-
:param delimiter: for representation
671-
:return: converted type
667+
Convert WLST value to model representation type
668+
:param data_type: the target data type for the model
669+
:param value: value to be converted
670+
:param preferred: the preferred data type to be represented in the model (optional)
671+
:param delimiter: the delimiter for parsing the WLST representation of the data value (optional)
672+
:return: converted value
672673
"""
673674

674675
_method_name = 'convert_from_type'
@@ -835,6 +836,14 @@ def get_dictionary_mode(alias_dict):
835836

836837

837838
def _jconvert_to_type(data_type, value, delimiter):
839+
"""
840+
Convert WLST value to model representation type.
841+
Assumes that empty values and password data types have been converted elsewhere.
842+
:param data_type: the target data type for the model
843+
:param value: value to be converted
844+
:param delimiter: the delimiter for parsing the WLST representation of the data value (optional)
845+
:return: converted value
846+
"""
838847
_method_name = '_jconvert_to_type'
839848
try:
840849
converted = TypeUtils.convertToType(data_type, value, delimiter)
@@ -857,15 +866,11 @@ def _jconvert_to_type(data_type, value, delimiter):
857866
elif data_type in (COMMA_DELIMITED_STRING, DELIMITED_STRING, SEMI_COLON_DELIMITED_STRING,
858867
SPACE_DELIMITED_STRING, PATH_SEPARATOR_DELIMITED_STRING):
859868
#
860-
# This code intentionally ignores the delimiter value passed in and computes it from the data type.
861-
# This is required to handle the special case where the value we read from WLST might have a
862-
# different delimiter than the model value. In this use case, the value passed into the method
863-
# is the WLST value delimiter and the data_type is the preferred_model_type, so we compute the
864-
# model delimiter from the data_type directly.
869+
# Data type value may be the wlst_type, wlst_read_type, or the preferred_model_type from the alias
870+
# definition. For any of these, the representation in the model should be comma-separated string.
865871
#
866-
delimiter = compute_delimiter_from_data_type(data_type, converted)
867-
if delimiter and converted:
868-
converted = delimiter.join(converted)
872+
if converted:
873+
converted = MODEL_LIST_DELIMITER.join(converted)
869874
except TypeError, te:
870875
ex = exception_helper.create_alias_exception('WLSDPLY-08021', value, data_type, delimiter, str(te))
871876
_logger.throwing(ex, class_name=_class_name, method_name=_method_name)

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
from wlsdeploy.aliases import model_constants
1515
from wlsdeploy.aliases.location_context import LocationContext
16+
from wlsdeploy.aliases.model_constants import MODEL_LIST_DELIMITER
1617
from wlsdeploy.aliases.wlst_modes import WlstModes
1718
from wlsdeploy.exception import exception_helper
1819
from wlsdeploy.logging.platform_logger import PlatformLogger
@@ -296,7 +297,7 @@ def discover_security_configuration(self):
296297
self._discover_subfolders(result, location)
297298
except DiscoverException, de:
298299
_logger.warning('WLSDPLY-06200', self._wls_version, de.getLocalizedMessage(),
299-
class_name=_class_name, method_name=_method_name)
300+
class_name=_class_name, method_name=_method_name)
300301
result = OrderedDict()
301302
_logger.exiting(class_name=_class_name, method_name=_method_name)
302303
return model_top_folder_name, result
@@ -532,18 +533,25 @@ def _add_classpath_libraries_to_archive(self, model_name, model_value, location)
532533
_method_name = 'add_classpath_libraries_to_archive'
533534
server_name = self._get_server_name_from_location(location)
534535
_logger.entering(server_name, model_name, model_value, class_name=_class_name, method_name=_method_name)
536+
535537
classpath_string = None
536538
if not StringUtils.isEmpty(model_value):
537-
classpath_list = []
538-
classpath_entries, separator = path_utils.split_classpath(model_value)
539+
classpath = path_utils.fixup_path(model_value)
540+
541+
# model values are comma-separated
542+
classpath_entries = classpath.split(MODEL_LIST_DELIMITER)
543+
539544
if classpath_entries:
545+
classpath_list = []
540546
for classpath_entry in classpath_entries:
541547
new_source_name = self._add_library(server_name, classpath_entry)
542548
if new_source_name is not None:
543549
classpath_list.append(new_source_name)
544-
classpath_string = StringUtils.getStringFromList(classpath_list, separator)
550+
551+
classpath_string = StringUtils.getStringFromList(classpath_list, MODEL_LIST_DELIMITER)
545552
_logger.fine('WLSDPLY-06617', server_name, classpath_string, class_name=_class_name,
546553
method_name=_method_name)
554+
547555
_logger.exiting(class_name=_class_name, method_name=_method_name, result=classpath_string)
548556
return classpath_string
549557

0 commit comments

Comments
 (0)