Exemple #1
0
    def __init__(self, program_name, domain_type):
        """
        The DomainTypedef constructor.
        :param program_name: the name of the program create this object
        :param domain_type: the domain type
        """
        _method_name = '__init__'

        self._logger = PlatformLogger('wlsdeploy.create')
        self._program_name = program_name
        self._domain_type = domain_type
        self.wls_helper = WebLogicHelper(self._logger)

        file_name = domain_type + self.__domain_typedef_extension
        self._domain_typedef_filename = path_utils.find_config_path(
            os.path.join('typedefs', file_name))

        # No need to explicitly validate the filename since the JsonToPython constructor does that...
        try:
            json_parser = JsonToPython(self._domain_typedef_filename)
            self._domain_typedefs_dict = json_parser.parse()
        except IllegalArgumentException, iae:
            ex = exception_helper.create_cla_exception(
                'WLSDPLY-12300',
                self._program_name,
                self._domain_type,
                self._domain_typedef_filename,
                iae.getLocalizedMessage(),
                error=iae)
            ex.setExitCode(CommandLineArgUtil.ARG_VALIDATION_ERROR_EXIT_CODE)
            self._logger.throwing(ex,
                                  class_name=self.__class_name,
                                  method_name=_method_name)
            raise ex
Exemple #2
0
    def _load_variable_injector_file(self, variable_injector_location):
        _method_name = '_load_variable_injector_file'
        _logger.entering(variable_injector_location,
                         class_name=_class_name,
                         method_name=_method_name)
        variables_dictionary = None

        # If -target is presence, it take precedence

        if self.__model_context is not None and self.__model_context.is_targetted_config(
        ):
            variables_dictionary = self.__model_context.get_target_configuration(
            ).get_variable_injectors()
        else:
            if os.path.isfile(variable_injector_location):
                try:
                    variables_dictionary = JsonToPython(
                        variable_injector_location).parse()
                    _logger.fine('WLSDPLY-19500',
                                 variable_injector_location,
                                 class_name=_class_name,
                                 method_name=_method_name)
                except (IllegalArgumentException, JsonException), e:
                    _logger.warning('WLSDPLY-19502',
                                    variable_injector_location,
                                    e.getLocalizedMessage(),
                                    class_name=_class_name,
                                    method_name=_method_name)
Exemple #3
0
def _load_injector_file(injector_file_name):
    _method_name = '_load_injector_file'
    _logger.entering(injector_file_name, class_name=_class_name, method_name=_method_name)
    injector_dictionary = dict()
    if os.path.isfile(injector_file_name):
        try:
            injector_dictionary = JsonToPython(injector_file_name).parse()
            __temporary_fix(injector_dictionary)
        except (IllegalArgumentException, JsonException), e:
            _logger.warning('WLDPLY-19409', injector_file_name, e.getLocalizedMessage(), class_name=_class_name,
                            method_name=_method_name)
Exemple #4
0
def _load_keywords_file(variable_keywords_location):
    _method_name = '_load_keywords_file'
    _logger.entering(variable_keywords_location, class_name=_class_name, method_name=_method_name)
    keywords_dictionary = None
    if os.path.isfile(variable_keywords_location):
        try:
            keywords_dictionary = JsonToPython(variable_keywords_location).parse()
            _logger.finer('WLSDPLY-19504', variable_keywords_location, class_name=_class_name, method_name=_method_name)
        except (IllegalArgumentException, JsonException), e:
            _logger.warning('WLSDPLY-19505', variable_keywords_location, e.getLocalizedMessage(),
                            class_name=_class_name, method_name=_method_name)