def __create_model_path_tokens(self, model_path=''): """ Creates a Python list from the elements in the specified model_path. :param model_path: A forward-slash delimited string contain the model path to print usage for :return: """ _method_name = '__create_model_path_tokens' self._logger.entering(model_path, class_name=_class_name, method_name=_method_name) if model_path[-1:] != ':': m = MODEL_PATH_PATTERN.match(model_path) if m is None: ex = exception_helper.create_validate_exception( 'WLSDPLY-05106', model_path) self._logger.throwing(ex, class_name=_class_name, method_name=_method_name) raise ex self._logger.finest('m.group(1)={0}, m.group(3)={1}', str(m.group(1)), str(m.group(3)), class_name=_class_name, method_name=_method_name) # Replace any ':' in model_path with '', then split it on '/' into a list model_path_tokens = model_path.replace(':', '').split('/') # Remove any blank list items caused by the user entering # extraneous '/' characters. while '' in model_path_tokens: del model_path_tokens[model_path_tokens.index('')] recognized_top_level_keys = model.get_model_top_level_keys() self._logger.finest('recognized_top_level_keys={0}', str(recognized_top_level_keys), class_name=_class_name, method_name=_method_name) top_level_key = model_path_tokens[0] if top_level_key not in recognized_top_level_keys: ex = exception_helper.create_validate_exception( 'WLSDPLY-05107', top_level_key, '%s' % ', '.join(recognized_top_level_keys)) self._logger.throwing(ex, class_name=_class_name, method_name=_method_name) raise ex return model_path_tokens
def __perform_model_file_validation(model_file_name, model_context): """ :param model_file_name: :param model_context: :return: :raises ValidationException: """ _method_name = '__perform_model_file_validation' __logger.entering(model_file_name, class_name=_class_name, method_name=_method_name) try: model_validator = Validator(model_context, logger=__logger) variable_map = model_validator.load_variables(model_context.get_variable_file()) model_dictionary = cla_helper.merge_model_files(model_file_name, variable_map) if cla_helper.check_persist_model(): persist_model_dict = copy.deepcopy(model_dictionary) variables.substitute(persist_model_dict, variable_map, model_context) cla_helper.persist_model(model_context, persist_model_dict) model_validator.validate_in_standalone_mode(model_dictionary, variable_map, model_context.get_archive_file_name()) except (TranslateException, VariableException), te: __logger.severe('WLSDPLY-20009', _program_name, model_file_name, te.getLocalizedMessage(), error=te, class_name=_class_name, method_name=_method_name) ex = exception_helper.create_validate_exception(te.getLocalizedMessage(), error=te) __logger.throwing(ex, class_name=_class_name, method_name=_method_name) raise ex
def __perform_model_file_validation(model_file_name, model_context): """ :param model_file_name: :param model_context: :return: :raises ValidationException: """ _method_name = '__perform_model_file_validation' __logger.entering(model_file_name, class_name=_class_name, method_name=_method_name) try: model_dictionary = cla_helper.merge_model_files(model_file_name) model_validator = Validator(model_context, logger=__logger) model_validator.validate_in_standalone_mode( model_dictionary, model_context.get_variable_file(), model_context.get_archive_file_name()) except TranslateException, te: __logger.severe('WLSDPLY-20009', _program_name, model_file_name, te.getLocalizedMessage(), error=te, class_name=_class_name, method_name=_method_name) ex = exception_helper.create_validate_exception( te.getLocalizedMessage(), error=te) __logger.throwing(ex, class_name=_class_name, method_name=_method_name) raise ex
def __validate_section_folder_path(self, model_path_tokens, valid_section_folder_keys): """ Verifies that a model path element is in the specified valid_section_folder_keys list. :param model_path_tokens: A Python list of path elements built from model path :param valid_section_folder_keys: A Python list of folder names :return: """ _method_name = '__validate_section_folder_path' if model_path_tokens[1] not in valid_section_folder_keys: ex = exception_helper.create_validate_exception('WLSDPLY-05108', '%s:/' % model_path_tokens[0], '%s' % '/'.join(model_path_tokens[1:]), '%s' % ', '.join(valid_section_folder_keys)) self._logger.throwing(ex, class_name=_class_name, method_name=_method_name) raise ex return