예제 #1
0
def __process_model_args(optional_arg_map):
    """
    Determine if the model file was passed separately or requires extraction from the archive.
    :param optional_arg_map: the optional arguments map
    :raises CLAException: if the arguments were not valid or an error occurred extracting the model from the archive
    """
    _method_name = '__process_model_args'

    if CommandLineArgUtil.PRINT_USAGE_SWITCH in optional_arg_map:
        # nothing to do since we are printing help information rather than validating supplied artifacts...
        return

    cla_helper.validate_optional_archive(_program_name, optional_arg_map)
    cla_helper.validate_model_present(_program_name, optional_arg_map)

    something_to_validate = False
    if CommandLineArgUtil.MODEL_FILE_SWITCH in optional_arg_map:
        something_to_validate = True

    if not something_to_validate:
        ex = exception_helper.create_cla_exception(
            'WLSDPLY-05400', _program_name,
            CommandLineArgUtil.PRINT_USAGE_SWITCH,
            CommandLineArgUtil.MODEL_FILE_SWITCH,
            CommandLineArgUtil.ARCHIVE_FILE_SWITCH)
        __logger.throwing(ex, class_name=_class_name, method_name=_method_name)
        raise ex
    return
예제 #2
0
def __process_args(args):
    """
    Process the command-line arguments and prompt the user for any missing information
    :param args: the command-line arguments list
    :raises CLAException: if an error occurs while validating and processing the command-line arguments
    """
    global __wlst_mode

    cla_util = CommandLineArgUtil(_program_name, __required_arguments,
                                  __optional_arguments)
    cla_util.set_allow_multiple_models(True)
    required_arg_map, optional_arg_map = cla_util.process_args(args)

    cla_helper.verify_required_args_present(_program_name,
                                            __required_arguments,
                                            required_arg_map)
    cla_helper.validate_optional_archive(_program_name, optional_arg_map)
    cla_helper.validate_model_present(_program_name, optional_arg_map)
    cla_helper.validate_variable_file_exists(_program_name, optional_arg_map)

    __wlst_mode = cla_helper.process_online_args(optional_arg_map)
    cla_helper.process_encryption_args(optional_arg_map)

    combined_arg_map = optional_arg_map.copy()
    combined_arg_map.update(required_arg_map)
    return model_context_helper.create_context(_program_name, combined_arg_map)
예제 #3
0
def __process_args(args):
    """
    Process the command-line arguments and prompt the user for any missing information
    :param args: the command-line arguments list
    :raises CLAException: if an error occurs while validating and processing the command-line arguments
    """
    cla_util = CommandLineArgUtil(_program_name, __required_arguments,
                                  __optional_arguments)
    cla_util.set_allow_multiple_models(True)
    argument_map = cla_util.process_args(args, TOOL_TYPE_CREATE)
    __process_java_home_arg(argument_map)
    __process_domain_location_args(argument_map)

    # don't verify that the archive is valid until it is needed.
    # this requirement is specific to create, other tools will verify it.
    cla_helper.validate_model_present(_program_name, argument_map)
    cla_helper.validate_variable_file_exists(_program_name, argument_map)

    #
    # Verify that the domain type is a known type and load its typedef.
    #
    domain_typedef = model_context_helper.create_typedef(
        _program_name, argument_map)

    __process_rcu_args(argument_map, domain_typedef.get_domain_type(),
                       domain_typedef)
    cla_helper.process_encryption_args(argument_map)
    __process_opss_args(argument_map)

    return model_context_helper.create_context(_program_name, argument_map,
                                               domain_typedef)
예제 #4
0
def __process_args(args):
    """
    Process the command-line arguments and prompt the user for any missing information
    :param args: the command-line arguments list
    :raises CLAException: if an error occurs while validating and processing the command-line arguments
    """
    cla_util = CommandLineArgUtil(_program_name, __required_arguments,
                                  __optional_arguments)
    cla_util.set_allow_multiple_models(True)
    required_arg_map, optional_arg_map = cla_util.process_args(
        args, TOOL_TYPE_EXTRACT)

    cla_helper.verify_required_args_present(_program_name,
                                            __required_arguments,
                                            required_arg_map)
    cla_helper.validate_optional_archive(_program_name, optional_arg_map)

    # determine if the model file was passed separately or requires extraction from the archive.
    cla_helper.validate_model_present(_program_name, optional_arg_map)
    cla_helper.validate_variable_file_exists(_program_name, optional_arg_map)
    cla_helper.process_encryption_args(optional_arg_map)

    combined_arg_map = optional_arg_map.copy()
    combined_arg_map.update(required_arg_map)
    return model_context_helper.create_context(_program_name, combined_arg_map)
예제 #5
0
def __process_model_args(argument_map):
    """
    Determine if the model file was passed separately or requires extraction from the archive.
    :param argument_map: the arguments map
    :raises CLAException: if the arguments were not valid or an error occurred extracting the model from the archive
    """
    _method_name = '__process_model_args'

    cla_helper.validate_optional_archive(_program_name, argument_map)

    try:
        cla_helper.validate_model_present(_program_name, argument_map)
    except CLAException, ce:
        # in lax validation mode, if no model is found, log at INFO and exit
        method = dictionary_utils.get_element(
            argument_map, CommandLineArgUtil.VALIDATION_METHOD)
        if method == CommandLineArgUtil.LAX_VALIDATION_METHOD:
            __logger.info('WLSDPLY-20032',
                          _program_name,
                          class_name=_class_name,
                          method_name=_method_name)
            model_context = model_context_helper.create_exit_context(
                _program_name)
            tool_exit.end(model_context, CommandLineArgUtil.PROG_OK_EXIT_CODE)
        raise ce
예제 #6
0
def __process_model_args(optional_arg_map):
    """
    Determine if the model file was passed separately or requires extraction from the archive.
    :param optional_arg_map:   the optional arguments map
    :raises CLAException: If an error occurs validating the arguments or extracting the model from the archive
    """
    cla_helper.validate_optional_archive(_program_name, optional_arg_map)
    cla_helper.validate_model_present(_program_name, optional_arg_map)
    return
예제 #7
0
def __process_model_args(optional_arg_map):
    """
    Verify that the specified model_file exists, or there is a model file in the specified archive_file.
    Extract the model file if only the archive_file was provided.
    :param optional_arg_map: the optional arguments map
    :raises CLAException: if the arguments are invalid or an error occurs extracting the model from the archive
    """

    # don't verify that the archive is valid until it is needed.
    # this requirement is specific to create, other tools will verify it.

    cla_helper.validate_model_present(_program_name, optional_arg_map)
    return
예제 #8
0
def __process_args(args):
    """
    Process the command-line arguments and prompt the user for any missing information
    :param args: the command-line arguments list
    :raises CLAException: if an error occurs while validating and processing the command-line arguments
    """
    global __wlst_mode

    cla_util = CommandLineArgUtil(_program_name, __required_arguments,
                                  __optional_arguments)
    argument_map = cla_util.process_args(args)

    # determine if the model file was passed separately or requires extraction from the archive.
    cla_helper.validate_model_present(_program_name, argument_map)

    return model_context_helper.create_context(_program_name, argument_map)
def __process_args(args):
    """
    Process the command-line arguments and prompt the user for any missing information
    :param args: the command-line arguments list
    :raises CLAException: if an error occurs while validating and processing the command-line arguments
    """
    global __wlst_mode

    cla_util = CommandLineArgUtil(_program_name, __required_arguments, __optional_arguments)
    required_arg_map, optional_arg_map = cla_util.process_args(args)

    cla_helper.verify_required_args_present(_program_name, __required_arguments, required_arg_map)

    # determine if the model file was passed separately or requires extraction from the archive.
    cla_helper.validate_model_present(_program_name, optional_arg_map)
    __process_injector_file(optional_arg_map)
    __process_keywords_file(optional_arg_map)
    __process_properties_file(optional_arg_map)

    combined_arg_map = optional_arg_map.copy()
    combined_arg_map.update(required_arg_map)
    return model_context_helper.create_context(_program_name, combined_arg_map)
def __process_args(args):
    """
    Process the command-line arguments and prompt the user for any missing information
    :param args: the command-line arguments list
    :raises CLAException: if an error occurs while validating and processing the command-line arguments
    """
    cla_util = CommandLineArgUtil(_program_name, __required_arguments,
                                  __optional_arguments)
    cla_util.set_allow_multiple_models(True)
    argument_map = cla_util.process_args(args, TOOL_TYPE_EXTRACT)

    cla_helper.validate_optional_archive(_program_name, argument_map)

    # determine if the model file was passed separately or requires extraction from the archive.
    cla_helper.validate_model_present(_program_name, argument_map)
    cla_helper.validate_variable_file_exists(_program_name, argument_map)
    cla_helper.process_encryption_args(argument_map)

    argument_map[CommandLineArgUtil.
                 VALIDATION_METHOD] = CommandLineArgUtil.LAX_VALIDATION_METHOD
    model_context = model_context_helper.create_context(
        _program_name, argument_map)
    model_context.set_ignore_missing_archive_entries(True)
    return model_context